0

Here is the API Documentation for the Javascript Youtube API: https://developers.google.com/youtube/js_api_reference

I was curious if anyone thinks it would be possible to create multiple instances of a an embedded SWF object so that I can have many videos buffering at the same time whilst having only one showing and playing at a given time.

My idea would be to create an unordered list in the DOM, and just call the SWFObject Embed function on each list item.

Would this most likely work?

4

1 回答 1

0

我没有使用 SWFObject 嵌入功能,因为我使用的是 HTML5 视频。当然可以同时播放多个视频,但是对于实际上没有播放的视频,缓冲并不总是发生。

如果您遵循 JavaScript API 示例代码,您可以像这样创建第二个播放器:

function onYouTubeIframeAPIReady() {
    player = new YT.Player('player', {
      height: '250',
      width: '400',
      videoId: 'EBM854BTGL0',
      events: {
        'onReady': onPlayerReady,
        'onStateChange': onPlayerStateChange
      }
    });

    player2 = new YT.Player('player2', {
      height: '195',
      width: '320',
      videoId: 'Pml2sqTI1Mw',
      events: {
        'onReady': onPlayer2Ready,
        'onStateChange': onPlayerStateChange
      }
    });
}
于 2013-10-17T23:16:28.900 回答