将youtube播放列表与侧面列表托盘嵌入

Ric*_*doE 10 embed youtube tray playlist

我一直在使用javascript播放youtube嵌入播放列表功能.

到目前为止,当我嵌入播放列表时,它看起来像这样:

http://postimage.org/image/vk6fv56yx/

蓝色圆圈显示播放列表中的项目数,单击缩略图时显示.

当视频开始播放时,必须单击播放列表按钮才能显示列表,如下所示:

http://postimage.org/image/ezzxpy7pn/

但是我希望播放器能够在youtube页面上显示,就像这样:

http://postimage.org/image/4suta8kuh/

现在这是我使用的代码:

<script>
  // Load the IFrame Player API code asynchronously.
  var tag = document.createElement('script');
  tag.src = "https://www.youtube.com/player_api";
  var firstScriptTag = document.getElementsByTagName('script')[0];
  firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

  // Replace the 'ytplayer' element with an <iframe> and
  // YouTube player after the API code downloads.
  var player;
  function onYouTubePlayerAPIReady() {
    player = new YT.Player('ytplayer', {
        height: '390',
        width: '640',
        videoId: 'n2ISkJZC6DI',
        playerVars: {
                  listType:'playlist',
                  list: 'PL546E6163151751EE'
                },
        events: {
            'onReady': onPlayerReady,
            'onStateChange': onPlayerStateChange
        }
    });
  }

  function onPlayerReady(){
    alert('player ready');
  }

  function onPlayerStateChange(){
    alert('player changed');
  }

</script>
Run Code Online (Sandbox Code Playgroud)

它很棒!但我想知道是否有办法改变播放列表托盘的视图.

非常感谢你的帮助人员:)

Sha*_*shy 0

您可以使用 YouTube 嵌入播放器的 Flash 版本来实现该外观。然而,托盘现在位于左侧。

YouTube 播放列表 Flash 播放器

<iframe width='500' height='294' src="https://www.youtube.com/v/videoseries?list=PL546E6163151751EE"></iframe>
Run Code Online (Sandbox Code Playgroud)

  • @AmineHADDAD,这并不是说它不受支持,它默认被禁用,并且只会在需要时请求运行闪存的权限。此外,由于上述原因,我建议不要使用这个答案。如果没有其他方法,就没有其他方法,但只要有,就在 IMO 上使用闪存。(无意冒犯这个答案的发布者,这只是前进的方向:)) (3认同)