gpt4 book ai didi

javascript - 为什么YouTube Player API循环无效?

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

我不知道为什么

我尝试使用Elementor Embed,现在尝试使用YouTube Player API。

self.elements.$player = new YT.Player( this.elements.$swiperContainer.find( '.elementor-repeater-item-' + sliderID + ' .elementor-background-video-embed' )[ i ], {
videoId: videoID,
events: {
'onReady': self.onPlayerReady,
},
playerVars: {
controls: 0,
rel: 0,
autoplay: 1,
loop: 1,
start: videoStart,
end: videoEnd,
},
} );

所有选项均可,但不能循环。
iframe结果:
<iframe class="elementor-background-video-embed" data-video-link="https://www.youtube.com/watch?v=L_dWvTCdDQ4" style="width: 762px; height: 428.625px;" frameborder="0" allowfullscreen="1" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" title="YouTube video player" width="640" height="360" src="https://www.youtube.com/embed/L_dWvTCdDQ4?controls=0&amp;rel=0&amp;autoplay=1&amp;loop=1&amp;start=50&amp;end=60&amp;widget_referrer=http%3A%2F%2Fcmsmasters-elementor.net%2Fwp-admin%2Fpost.php%3Fpost%3D738%26action%3Delementor&amp;enablejsapi=1&amp;origin=http%3A%2F%2Fcmsmasters-elementor.net&amp;widgetid=17" id="widget18"></iframe>

它会是带有视频的Slider,用于Elementor。

最佳答案

这个问题已经在这里问了Loop option doesn't work in the youtube js api
根据Youtube API文档,您应该:

"set the loop parameter value to 1 and set the playlist parametervalue to the same video ID already specified in the Player API URL"


请在此处查看Youtube API文档= https://developers.google.com/youtube/player_parameters#loop

关于javascript - 为什么YouTube Player API循环无效?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60707807/

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