Youtube IFrame Player API - 禁用Youtube自动恢复视频 [英] Youtube IFrame Player API - Disable Youtube auto resume video where I left off

查看:215
本文介绍了Youtube IFrame Player API - 禁用Youtube自动恢复视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Youtube IFrame Player API播放来自Youtube的视频。
我希望视频从头开始播放,但Youtube会自动从我上次离开的地方恢复视频。

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.

这是我的代码:

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 启动参数,但它没有工作。

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

如何解决这个问题?

推荐答案

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

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

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

我使用带参数的直接网址进行了测试。

I tested with direct url with parameters.


  1. 示例,其中start = 0 example0

  2. 示例有start = 1 example1

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

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

You will see that start=1 will works correctly.

这篇关于Youtube IFrame Player API - 禁用Youtube自动恢复视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆