2

I have a video that I want to create as a variable so I can insert it into the HTML string. This is what I have right now.

Variable:

var vids = 'big_buck_bunny.mp4';

HTML string:

'<source type="video/mp4" src="videos/' + vids + '" />' 

When I refresh the browser it does not find the video

1 Answer 1

0

You are missing a ", at the end of src="videos/, or at least, have mismatched quotes somewhere.

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

4 Comments

@user2958098 I'm not very familiar with JavaScript, so I can't answer definitively. It just seems to be that you need another single ' before videos/ and remove the code after vids. Ex: src="'videos/' to specify the videos/ directory, then ` + vids '` to specify the variable. Combine those two and you would have src="'videos/' + vids "
@user2958098 Check out this SO question and this question, too
@user2958098 Can you post what ended up working for you? Just in case anyone else has the same/similar issue. Glad you were able to get it to work!
I fully qualified the url var vids = 'localhost/ExpandableVideoUnit/videos/big_buck_bunny.mp4'; and then I put it above the hhtml string '<source type="video/mp4" src="' + vids + '" />' and it worked

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.