I was looking for a solution to this problem and apparently
Steve Lacey's solution:
Sure. You can do the equivalent of 'video.src = "";
It seems to work on my OSX 10.9, in browsers: Safari 7.0, Firefox 26.0 and Chrome 31. However, I have not tested it on mobile devices.
I tested it with a video object created using JS:
var object = document.createElement("video"); /// ... some setup like poster image, size, position etc. goes here... /// now, add sources: var sourceMP4 = document.createElement("source"); sourceMP4.type = "video/mp4"; sourceMP4.src = "path-to-video-file.mp4"; object.appendChild(sourceMP4); //// same approach add ogg/ogv and webm sources
Now that I want to stop the video again and show the poster, I just do:
object.pause(); object.src = "";
But this is not enough, since the video will not be able to play again. To make it reproducible after this point, I removed the 'src' attribute (leaving the "source" sub-objects as they are):
object.removeAttribute("src");
After that it works:
- video playback
- when the video is stopped, the poster will reappear
- can play the same video again
source share