videojs-playlist
videojs-playlist copied to clipboard
Adding new videos to the list at runtime
Hi, A basic question/query. how can I add new videos to the playlist at runtime? Is there any function like player.playlist.add()?
Thanks in advance
Am looking for the same function, am wondering if updating the video array will work?
Have you found a way since then?
const myPlaylist = [...];
player.playlist(myPlaylist);
...
myPlaylist.push(myNextVideo);
player.playlist(myPlaylist, -1);
should do the trick. The current playing item will not be changed with the -1
parameter, but ofc this might behave weird if you change the item at the current position in myPlaylist
(ie. remove items or reorder). Should have no issues with just appending though.
Thanks @albe This works.
this work for add at runtume, but how remove item played ?