Youtube 嵌入的播放列表显示播放按钮而不是第一个视频 [英] Youtube embedded playlist diplays playall button instead of the first video
问题描述
我有一个嵌入式 Youtube 播放列表,在过去 9 个月左右的时间里一直运行良好.它显示播放列表的第一个视频,每当我们有新视频要显示时,我们就会每隔几天将一个新视频放在列表的前面.
I have an embedded Youtube Playlist which used to work fine for the past 9 months or so. It displays the first video of the playlist and we put a new video to the front of the list every few days whenever we have a new video to show.
过去几天,Youtube 已停止显示播放列表的第一个视频,而是显示全部播放"按钮.为什么会突然开始发生这种情况?
Over the past few days Youtube has stopped displaying the first video of the playlist and instead it is displaying a 'Play all' button. Why has this suddenly started to happen?
我们没有更改任何嵌入的 youtube 参数.
We didn't change any of the embedded youtube parameters.
更新
只是为了澄清.我得到的不是第一个视频的嵌入图像,而是一个黑屏,上面有全部播放"按钮和播放"符号.我们尝试更改视频并放入新视频,但徒劳无功.单击全部播放",然后开始播放器中嵌入的视频.
Just to clarify. Instead of the embed image of the first video I am getting just a black screen with the Play All button and the Play symbol on top of it. We tried changing videos and putting new ones in all in vain. Clicking on Play All then starts the video embedded in the player.
推荐答案
使用 嵌入选项嵌入播放列表时,看起来确实发生了一些不太正确的事情.除了您提到的问题之外,当您最终开始播放列表时,它似乎从索引 1(即第二个视频)而不是索引 0 开始.如果已记录了引用此行为的票证,则可能值得一看.
It does look like there is something not quite right happening when embedding a playlist with the <iframe>
embed option. In addition to the issues you mention, it looks like when you finally do start playing the list, it is starting at index 1 (i.e. the 2nd video) rather than index 0. Might be worth seeing if a ticket has been logged referencing this behavior.
我可以确认使用 iframe API 会达到预期的结果:类似这样:
I can confirm that using the iframe API will achieve the desired results: something like this:
<!DOCTYPE html>
<html>
<body>
<div id="player"></div>
<script>
var tag = document.createElement('script');
tag.src = "https://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
var player;
function onYouTubeIframeAPIReady() {
player = new YT.Player('player', {
height: '390',
width: '640',
videoId: '',
events: {
'onReady': onPlayerReady
}
});
}
function onPlayerReady(event) {
player.cuePlaylist({'listType':'playlist','list':'PLE2714DC8F2BA092D'});
}
</script>
</body>
</html>
加载播放列表中第一个视频的海报,一旦您开始播放它,播放列表工具栏就会在底部显示,以便导航到列表中的其他视频.
The poster for the first video in the playlist loads, and once you start playing it, then the playlist toolbar becomes available along the bottom for navigating to other videos in the list.
这篇关于Youtube 嵌入的播放列表显示播放按钮而不是第一个视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!