Reputation: 37
Can someone pls fix this javascript function:
function open(file, poster) {
document.getElementById("video").innerHTML = "<video class='right' width='320' height='240' controls poster='" + poster + "'>
<source src='" + file + "' type='video/mp4'>
Your browser does not support the video tag.
</video>"
}
and just to be sure, when i call it, call it like this:
open(file.mp4, poster.png);
or like this:
open("file.mp4", "poster.png");
Upvotes: 0
Views: 3019
Reputation: 1
All you did wrong was the multiline string - not a good idea injavascript
function openVideo(file, poster) {
document.getElementById("video").innerHTML = "<video class='right' width='320' height='240' controls poster='" + poster + "'><source src='" + file + "' type='video/mp4'>Your browser does not support the video tag.</video>"
}
// call using the following format
openVideo('file.mp4', 'poster.png');
Upvotes: 1