How to use setCurrentTime() on vimeo video within a playlist?

二次信任 提交于 2020-12-15 05:26:30

问题


I'm trying to set the current time for the last video in the playlist, but it always fails. This is the code I'm working on with my try. It doesn't set the time at all and I don't know how to solve.

    var iframe = document.querySelector('iframe.main-player');
    var player = new Vimeo.Player(iframe);
    var video_ids = [123456789, 987654321, 543216789];

    var index = 0;
    var playNext = function(data) {

        if (index <= video_ids.length)
            player.loadVideo(video_ids[index++])

    }

    let last = video_ids.length - 1;

    player.loadVideo(video_ids[index++]);
    player.on('loaded', function() {

        if (last == index++) {
             player.setCurrentTime(200);
        }
        player.play();

    });

    player.on('ended', playNext);

来源:https://stackoverflow.com/questions/64857210/how-to-use-setcurrenttime-on-vimeo-video-within-a-playlist

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!