Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/video/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Youtube IFrame播放器API-禁用我中断的Youtube自动恢复视频_Javascript_Video_Iframe_Youtube - Fatal编程技术网

Javascript Youtube IFrame播放器API-禁用我中断的Youtube自动恢复视频

Javascript Youtube IFrame播放器API-禁用我中断的Youtube自动恢复视频,javascript,video,iframe,youtube,Javascript,Video,Iframe,Youtube,我正在使用Youtube IFrame播放器API播放来自Youtube的视频。 我希望视频从一开始就播放,但Youtube会自动从我上次停止的位置恢复视频 这是我的密码: new YT.Player('yt-player', { height: '439', width: '100%', videoId: 'my-video-id', startSeconds: 0, playerVars: {

我正在使用Youtube IFrame播放器API播放来自Youtube的视频。 我希望视频从一开始就播放,但Youtube会自动从我上次停止的位置恢复视频

这是我的密码:

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();
                }
        }
})
我尝试使用
startSeconds
start
参数,但不起作用


如何解决此问题?

尝试将
start:0
更改为
start:1

这应该会重置视频,但我不知道原因

我使用带有参数的直接url进行了测试

  • start=0的示例
  • start=1的示例

  • 您将看到start=1将正常工作。

    感谢您的回复<代码>开始:1表示视频从第一秒开始播放,而不是从一开始就开始播放不确定是否有帮助。在小提琴中,我使用
    player.seekTo(0)玩家状态更改为播放后。