videojs-playlist icon indicating copy to clipboard operation
videojs-playlist copied to clipboard

Adding new videos to the list at runtime

Open rohitashokkhot opened this issue 6 years ago • 4 comments

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

rohitashokkhot avatar Apr 13 '18 02:04 rohitashokkhot

Am looking for the same function, am wondering if updating the video array will work?

Have you found a way since then?

yucolabjames avatar Aug 03 '18 04:08 yucolabjames

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.

albe avatar Jul 10 '19 11:07 albe

Thanks @albe This works.

HariShankarS avatar Jul 11 '19 07:07 HariShankarS

this work for add at runtume, but how remove item played ?

tulkas85 avatar Jun 11 '20 10:06 tulkas85