0

i have a video from videojs:

<video id="movie" class="video-js vjs-default-skin" controls
                preload="auto" width="638" height="480" poster="resources/movies/botschafter/1/test/skins/express_show_silver/video_titel.png"
                data-setup="{}">
                <source src="resources/botschafter/module1/1/test/botschafter_herkunft.flv" type='video/mp4' />
                <source src="my_video.webm" type='video/webm' />
            </video>

i want to build source dynamically. now it is static: <source src="resources/botschafter/module1/1/test/botschafter_herkunft.flv" type='video/mp4' />

i like to have it like this:

var moduleName; var stepNr;

<source src="resources/botschafter/"+ moduleName +"/"+ stepNr +"/test/botschafter_herkunft.flv" type='video/mp4' />

just because src already surrounded with "", how to insert new variables into it??

1 Answer 1

1

do it like this:

var code = '<source src="resources/botschafter/' + moduleName +'/'+ stepNr + '/test/botschafter_herkunft.flv" type="video/mp4" />'

You can use double quotes inside single quotes: 'he said: "I love you!"' and backwards: "he said: 'I love you!'". Also, you may screen symbols inside strings: "Here's some \"quoted\" text"

Sign up to request clarification or add additional context in comments.

1 Comment

hi, i tried it like this & its not running. <source src='resources/movies/"+ moduleName +"/"+ stepNr +"/test/botschafter_herkunft.flv' type='video/mp4' />

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.