11 ms·
> [0] That could be handled by allowing the media tag to be changed and restarted with a new URL during (and only during) the "ended" event[1]. That would allo
by pdkl95 10y ago
> [0]
That could be handled by allowing the media tag to be changed and restarted with a new URL during (and only during) the "ended" event[1]. That would allow continuing an already playing video with minimal side effects. E.g. only alow something like this:
var video = document.getElementsById("current_video_tag");
var play_next_video = function () {
video.src = "https://exmple.com/next_video_url";
video.currentTime = 0;
video.play();
});
/* this should work */
video.addEventListener("ended", play_next_video);
/* but these shouldn't */
video.addEventListener("progress", play_next_video);
setTimeout(play_next_video, 1000);
[1] https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Media_events https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Me...
- kuschku 10y agoAnd what if you want to support changing the video through remote control? Say, allow the user to open the site on their phone and TV, and the phone shows play/pause/next buttons, the TV shows the episode, and the phone can be used to skip to the next episode? (Data synced because the user is logged in on both, via a standard webbrowser)?