How to load playlist without restart the current playing video

后端 未结 1 1062
梦如初夏
梦如初夏 2021-01-15 22:13

When we add a new item to playlist use following code when a video is playing.

var playlist = jwplayer().getPlaylist();
    var newItem = {
        file: vid         


        
1条回答
  •  被撕碎了的回忆
    2021-01-15 22:56

    var curpos = jwplayer().getPosition();
    var playlist = jwplayer().getPlaylist();
    var newItem = {
        file: videoUrl,
        image: videoThumb,
        title: videoTitle
    };
    playlist.push(newItem);
    jwplayer().load(playlist).onPlay(function () {
        jwplayer().seek(curpos);
    });
    

    Get position of the currently playing item, get playlist, add item to playlist, load playlist and resume playing using seek and position variable. You might have to get the currently playing item's index so after the playlist loads you go back to that item and then resume playing.

    0 讨论(0)
提交回复
热议问题