<tfoot id='MdB71'></tfoot>
  • <legend id='MdB71'><style id='MdB71'><dir id='MdB71'><q id='MdB71'></q></dir></style></legend>

  • <i id='MdB71'><tr id='MdB71'><dt id='MdB71'><q id='MdB71'><span id='MdB71'><b id='MdB71'><form id='MdB71'><ins id='MdB71'></ins><ul id='MdB71'></ul><sub id='MdB71'></sub></form><legend id='MdB71'></legend><bdo id='MdB71'><pre id='MdB71'><center id='MdB71'></center></pre></bdo></b><th id='MdB71'></th></span></q></dt></tr></i><div id='MdB71'><tfoot id='MdB71'></tfoot><dl id='MdB71'><fieldset id='MdB71'></fieldset></dl></div>

      <small id='MdB71'></small><noframes id='MdB71'>

        <bdo id='MdB71'></bdo><ul id='MdB71'></ul>

        为什么 YouTube JavaScript Player API 打开一个与我的代码不同的 URL,只播放播放列表的第

        Why YouTube JavaScript Player API open a different URL than the one in my code, and just play the first video of a playlist?(为什么 YouTube JavaScript Player API 打开一个与我的代码不同的 URL,只播放播放列表的第一个视频?) - IT屋-程序员软件开

          • <small id='Hb9wE'></small><noframes id='Hb9wE'>

            <i id='Hb9wE'><tr id='Hb9wE'><dt id='Hb9wE'><q id='Hb9wE'><span id='Hb9wE'><b id='Hb9wE'><form id='Hb9wE'><ins id='Hb9wE'></ins><ul id='Hb9wE'></ul><sub id='Hb9wE'></sub></form><legend id='Hb9wE'></legend><bdo id='Hb9wE'><pre id='Hb9wE'><center id='Hb9wE'></center></pre></bdo></b><th id='Hb9wE'></th></span></q></dt></tr></i><div id='Hb9wE'><tfoot id='Hb9wE'></tfoot><dl id='Hb9wE'><fieldset id='Hb9wE'></fieldset></dl></div>
              <tbody id='Hb9wE'></tbody>

            1. <tfoot id='Hb9wE'></tfoot>
              • <bdo id='Hb9wE'></bdo><ul id='Hb9wE'></ul>
                • <legend id='Hb9wE'><style id='Hb9wE'><dir id='Hb9wE'><q id='Hb9wE'></q></dir></style></legend>

                  本文介绍了为什么 YouTube JavaScript Player API 打开一个与我的代码不同的 URL,只播放播放列表的第一个视频?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  这是我的第一篇文章,希望我遵守所有规则.

                  It is my first post, I hope I respected all the rules.

                  我正在尝试在我的网站页面上发布:随机播放/静音/自动播放 youtube 播放列表.

                  I am trying to publish on a page of my website a: shuffle / muted / autoplay youtube playlist.

                  我使用了AS3的方法,带有SWFObject.

                  I used the method AS3, with SWFObject.

                  以下代码一切正常,但几周后,播放器没有检测到我的播放列表,只播放第一个视频.

                  Everything worked fine with the following code, but since few weeks, the player doesn't detect my playlist and just play the first video.

                  在代码中,URL 是:https://www.youtube.com/v/HuIGf4IJzdM&list=PLo-QIlIZx6myBxEysxrWoE-f58-psKGji

                  In the code, the URL is : https://www.youtube.com/v/HuIGf4IJzdM&list=PLo-QIlIZx6myBxEysxrWoE-f58-psKGji

                  但是当我打开页面的页面时,它会打开以下链接:https://www.youtube.com/v/HuIGf4IJzdM&list=o-QIlIZx6myBxEysxrWoE-f58-psKGji

                  But when I open the page of the page, it open the following link : https://www.youtube.com/v/HuIGf4IJzdM&list=o-QIlIZx6myBxEysxrWoE-f58-psKGji

                  这是代码,如果我没记错的话,之前可以正常工作:

                  Here is the code wich, if I am not wrong, works fine precedently :

                  <script src="https://www.google.com/jsapi"></script>
                  <script src="https://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
                  <div id="ytapiplayer">You need Flash player 8+ and JavaScript enabled to view this video.</div>
                  <script type="text/javascript">
                  google.load("swfobject", "2.2");
                  function onYouTubePlayerReady(playerId) {
                  ytplayer = document.getElementById("myytplayer");
                  ytplayer.playVideo();
                  ytplayer.setShuffle(true);
                  ytplayer.mute();
                  }
                  var params = {allowScriptAccess: "always" , allowFullScreen : "true"};
                  var atts = { id: "myytplayer" };
                  
                  swfobject.embedSWF("https://www.youtube.com/v/HuIGf4IJzdM&list=PLo-QIlIZx6myBxEysxrWoE-f58-psKGji&index=0&feature=plpp_play_all?enablejsapi=1&playerapiid=ytplayer&allowFullScreen=true&version=3&loop=1&autohide=1",
                  "ytapiplayer", "50%", "50%", "10", null, null, params, atts)
                  </script>
                  

                  如果有人能帮我找到这个问题的解决方案,非常感谢!

                  Thank you a lot if someone can help me to fin the solution to this problem !!

                  推荐答案

                  我终于找到了另一种方法来让它与 iframe 一起工作.

                  I finally found an alternative way to make it work with an iframe.

                  代码如下:

                  <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: '100%',
                        width: '100%',
                        events: {
                          'onReady': onPlayerReady
                        }
                  
                      });
                    }
                  
                    function onPlayerReady(event) {
                  
                      event.target.loadPlaylist({'listType': 'playlist',
                                                 'list': 'PLo-QIlIZx6myBxEysxrWoE-f58-psKGji',
                                                 'index': '0'
                                                });
                        event.target.mute();
                        event.target.setLoop(true);
                      setTimeout( function() { 
                          event.target.setShuffle(true); 
                      }, 2000);
                        }
                  </script>
                  

                  感谢您的帮助:-)

                  这篇关于为什么 YouTube JavaScript Player API 打开一个与我的代码不同的 URL,只播放播放列表的第一个视频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Pause youtube video, youtube api(暂停 youtube 视频,youtube api)
                  Youtube iframe api not triggering onYouTubeIframeAPIReady(Youtube iframe api 未触发 onYouTubeIframeAPIReady)
                  How can I stop a video with Javascript in Youtube?(如何在 Youtube 中停止使用 Javascript 的视频?)
                  Embed YouTube video - Refused to display in a frame because it set #39;X-Frame-Options#39; to #39;SAMEORIGIN#39;(嵌入 YouTube 视频 - 拒绝显示在框架中,因为它将“X-Frame-Options设置为“SAMEORIGIN)
                  How to call Greasemonkey#39;s GM_ functions from code that must run in the target page scope?(如何从必须在目标页面范围内运行的代码中调用 Greasemonkey 的 GM_ 函数?)
                  How do you mute an embedded Youtube player?(如何使嵌入式 Youtube 播放器静音?)
                • <small id='m2gVH'></small><noframes id='m2gVH'>

                    <bdo id='m2gVH'></bdo><ul id='m2gVH'></ul>
                      <tbody id='m2gVH'></tbody>

                          <tfoot id='m2gVH'></tfoot>
                        • <legend id='m2gVH'><style id='m2gVH'><dir id='m2gVH'><q id='m2gVH'></q></dir></style></legend>
                          <i id='m2gVH'><tr id='m2gVH'><dt id='m2gVH'><q id='m2gVH'><span id='m2gVH'><b id='m2gVH'><form id='m2gVH'><ins id='m2gVH'></ins><ul id='m2gVH'></ul><sub id='m2gVH'></sub></form><legend id='m2gVH'></legend><bdo id='m2gVH'><pre id='m2gVH'><center id='m2gVH'></center></pre></bdo></b><th id='m2gVH'></th></span></q></dt></tr></i><div id='m2gVH'><tfoot id='m2gVH'></tfoot><dl id='m2gVH'><fieldset id='m2gVH'></fieldset></dl></div>