Youtube IFrame Player API - Disable Youtube auto resume video where I left off

百般思念 提交于 2020-01-17 10:58:12

问题


I'm using the Youtube IFrame Player API to play a video from Youtube. I want the video to be played from the beginning but Youtube automatically resume the video from where I last left off.

Here is my code:

new YT.Player('yt-player', {
        height: '439',
        width: '100%',
        videoId: 'my-video-id',
        startSeconds: 0,
        playerVars: {
                controls: 0,
                color: 'white',
                disablekb: 1,
                enablejsapi: 0,
                modestbranding: 1,
                rel: 0,
                showinfo: 1,
                iv_load_policy: 3,
                start: 0
        },
        events: {
                onReady: function() {
                         this.playVideo();
                }
        }
})

I tried using startSeconds and start parameters but it does not work.

How can I fix this problem?


回答1:


Try to change the start:0 to start:1.

This should reset the video but I don't know the reason.

I tested with direct url with parameters.

  1. Example with start=0 example0
  2. Example with start=1 example1

You will see that start=1 will works correctly.



来源:https://stackoverflow.com/questions/44279527/youtube-iframe-player-api-disable-youtube-auto-resume-video-where-i-left-off

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