shiyiya / oplayer

:zap: Another HTM5 video player.
https://oplayer.vercel.app
MIT License
147 stars 19 forks source link

Is there any option in Player to update Playlist array #101

Closed MuhammadTufailAli closed 11 months ago

MuhammadTufailAli commented 11 months ago

I am using Oplayer to display playlist. I have my fav channels in it and when i click on my fav button then my array length is increased for example before my channels array was 10 and after liking one channel it becomes 11. Now i want to update my playlist how can i do this. This there any way in Oplyaer to do this.

shiyiya commented 11 months ago

player.context.playlist.changeSource([]) // will replay list from index i think

MuhammadTufailAli commented 11 months ago

Let me try this

MuhammadTufailAli commented 11 months ago

How i am going to use it can you please give me an example i have array in variable called newSources

shiyiya commented 11 months ago

player.context.playlist.changeSourceList(sources)

MuhammadTufailAli commented 11 months ago

When i did it i got Following sssss

shiyiya commented 11 months ago

code?

MuhammadTufailAli commented 11 months ago

For testing purpose i am changing list when i click on next button My code const newSources = AllChannelsinonearray.slice(1);

          newplayer.context.playlist.changeSourceList(newSources);
          i am doing this
MuhammadTufailAli commented 11 months ago

is it possible that playlist change without reload

shiyiya commented 11 months ago

may be newsource format error.

shiyiya commented 11 months ago

Next time, please use the template to create an issue

MuhammadTufailAli commented 11 months ago

Format is same i am using AllChannelsinonearray when i am first creating player playlist and when i click next button i just slice one element from it and do this const newSources = AllChannelsinonearray.slice(1); newplayer.context.playlist.changeSourceList(newSources);

shiyiya commented 11 months ago

no, changesourcelist(list) list just [{ src?: string duration?: string subtitles?: SubtitleSource[] thumbnails?: Thumbnails highlights?: Highlight[] }]