is it possible to read a video with the HTML5 Video tag returned by a PHP Service Chunked Response?
What i am trying to achieve is to return a response created from 3 different video files in a single response.
Thanks in advance!
is it possible to read a video with the HTML5 Video tag returned by a PHP Service Chunked Response?
What i am trying to achieve is to return a response created from 3 different video files in a single response.
Thanks in advance!
One option is to use the video element's "ended" event to load the second video. Something like this should work. You may need to use an XMLHttpRequest to get the url of the new video, etc.
var vid = document.getElementById("your-video-element");
vid.addEventListener("ended", function() {
vid.src = "new video url";
vid.play()
});
If you need the playback to begin immediately you could queue it up ahead of time on another invisible video element to get it cached. This will use more bandwidth while two videos are loading at the same time.
var vid = document.getElementById("your-video-element");
var nextVid = document.createElement("video");
nextVid.src = "second video url";
nextVid.preload = "auto";
vid.addEventListener("ended", function() {
vid.src = nextVid.src;
vid.play();
});
Setting preload = "auto"
does not guarantee that the browser will preload the video, but leaves it up to the browser to decide.