gpt4 book ai didi

html - YouTube Video API不遵守 'replay'参数值

转载 作者:行者123 更新时间:2023-12-03 05:54:39 25 4
gpt4 key购买 nike

我正在尝试使用iframe及其公开API嵌入YouTube视频。我希望重播视频,即使使用loop参数,我的视频也会在第一次播放后结束。

API Docs代表loop:

In the case of a single video player, a setting of 1 causes the player to play the initial video again and again. In the case of a playlist player (or custom player), the player plays the entire playlist and then starts again at the first video.

Supported values are 0 and 1, and the default value is 0.

Note: This parameter has limited support in the AS3 player and in IFrame embeds, which could load either the AS3 or HTML5 player. Currently, the loop parameter only works in the AS3 player when used in conjunction with the playlist parameter. To loop a single video, set the loop parameter value to 1 and set the playlist parameter value to the same video ID already specified in the Player API URL: https://www.youtube.com/v/VIDEO_ID? version=3 &loop=1 &playlist=VIDEO_ID



(更新)示例视频: https://codepen.io/denver-bohling/pen/jYegyq

最佳答案

To loop a single video, set the loop parameter value to 1 and set the playlist parameter value to the same video ID already specified in the Player API URL



Codepen中代码的问题是附加了错误的播放列表ID(在值前加上空格,并在值后加上问号。)

同时将正确的视频ID指定为播放列表ID,它可以循环播放:
<iframe src="https://www.youtube.com/embed/0CUuvFjicqk?autoplay=1&loop=1&playlist=0CUuvFjicqk"></iframe> 

(嵌入在这里不能用作代码段,iframe不会加载,但这是经过修改的笔: https://codepen.io/anon/pen/ppxBWR)

关于html - YouTube Video API不遵守 'replay'参数值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48293753/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com