<tfoot id='ggjBL'></tfoot>

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

        <bdo id='ggjBL'></bdo><ul id='ggjBL'></ul>
      <legend id='ggjBL'><style id='ggjBL'><dir id='ggjBL'><q id='ggjBL'></q></dir></style></legend>
      <i id='ggjBL'><tr id='ggjBL'><dt id='ggjBL'><q id='ggjBL'><span id='ggjBL'><b id='ggjBL'><form id='ggjBL'><ins id='ggjBL'></ins><ul id='ggjBL'></ul><sub id='ggjBL'></sub></form><legend id='ggjBL'></legend><bdo id='ggjBL'><pre id='ggjBL'><center id='ggjBL'></center></pre></bdo></b><th id='ggjBL'></th></span></q></dt></tr></i><div id='ggjBL'><tfoot id='ggjBL'></tfoot><dl id='ggjBL'><fieldset id='ggjBL'></fieldset></dl></div>
      1. 点击链接 javascript 播放 iframe 视频

        play iframe video on click a link javascript(点击链接 javascript 播放 iframe 视频)

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

                <tbody id='xEQVI'></tbody>

              1. <legend id='xEQVI'><style id='xEQVI'><dir id='xEQVI'><q id='xEQVI'></q></dir></style></legend>
                <i id='xEQVI'><tr id='xEQVI'><dt id='xEQVI'><q id='xEQVI'><span id='xEQVI'><b id='xEQVI'><form id='xEQVI'><ins id='xEQVI'></ins><ul id='xEQVI'></ul><sub id='xEQVI'></sub></form><legend id='xEQVI'></legend><bdo id='xEQVI'><pre id='xEQVI'><center id='xEQVI'></center></pre></bdo></b><th id='xEQVI'></th></span></q></dt></tr></i><div id='xEQVI'><tfoot id='xEQVI'></tfoot><dl id='xEQVI'><fieldset id='xEQVI'></fieldset></dl></div>
                  <bdo id='xEQVI'></bdo><ul id='xEQVI'></ul>
                  <tfoot id='xEQVI'></tfoot>
                • 本文介绍了点击链接 javascript 播放 iframe 视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我在我的网页中使用了 iframe 视频.这是我的html代码

                  I have used a iframe video in my web page. This is my html code

                  <iframe id="video1" width="520" height="360" src="http://www.youtube.com/embed/TJ2X4dFhAC0?enablejsapi" frameborder="0" allowtransparency="true" allowfullscreen></iframe>
                  <a href="#" id="playvideo">Play video</a>
                  

                  我需要 play 视频 onclick 播放视频链接.我该怎么做?

                  I need to play video onclick the play video link. How can i do that?

                  推荐答案

                  这可行,它将 autoplay=1 附加到 url 导致视频开始播放.

                  This works, it appends autoplay=1 to the url causing the video to start playing.

                  附录:如果您的视频源还没有查询字符串,那么最好添加 ? 而不是 &, 有时是这样.这可以通过寻找它的存在来完成.

                  addendum: If your video's source does not already have a querystring then it would be prudent to add a ? instead of a &, as is sometimes the case. This can be done by looking for its existence.

                  <iframe id="video1" width="520" height="360" src="http://www.youtube.com/embed/TJ2X4dFhAC0?enablejsapi" frameborder="0" allowtransparency="true" allowfullscreen></iframe>
                  <a href="#" id="playvideo">Play video</a>
                  <script>
                   //use .one to ensure this only happens once
                   $("#playvideo").one(function(){
                    //as noted in addendum, check for querystring exitence
                    var symbol = $("#video1")[0].src.indexOf("?") > -1 ? "&" : "?";
                    //modify source to autoplay and start video
                    $("#video1")[0].src += symbol + "autoplay=1";
                   });
                  </script>
                  

                  但是,大多数人天生就明白,如果他们想要播放视频,他们只需点击它,我建议将其留给他们或通过自动播放开始视频.

                  However, most people inherently understand that if they want a video to play, they will just click on it and I would suggest just leaving that to them or starting the video off with autoplay.

                  还需要提到自动播放在移动设备(由 Android 或 iOS 驱动)上不起作用

                  Also need to mention that autoplay does not work on mobile devices (powered by Android or iOS)

                  这篇关于点击链接 javascript 播放 iframe 视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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 的视频?)
                  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 播放器静音?)
                  How to get number of video views with YouTube API?(如何使用 YouTube API 获取视频观看次数?)
                  <i id='0Uqdf'><tr id='0Uqdf'><dt id='0Uqdf'><q id='0Uqdf'><span id='0Uqdf'><b id='0Uqdf'><form id='0Uqdf'><ins id='0Uqdf'></ins><ul id='0Uqdf'></ul><sub id='0Uqdf'></sub></form><legend id='0Uqdf'></legend><bdo id='0Uqdf'><pre id='0Uqdf'><center id='0Uqdf'></center></pre></bdo></b><th id='0Uqdf'></th></span></q></dt></tr></i><div id='0Uqdf'><tfoot id='0Uqdf'></tfoot><dl id='0Uqdf'><fieldset id='0Uqdf'></fieldset></dl></div>

                    <legend id='0Uqdf'><style id='0Uqdf'><dir id='0Uqdf'><q id='0Uqdf'></q></dir></style></legend>

                        <tbody id='0Uqdf'></tbody>
                        • <small id='0Uqdf'></small><noframes id='0Uqdf'>

                            <bdo id='0Uqdf'></bdo><ul id='0Uqdf'></ul>

                          • <tfoot id='0Uqdf'></tfoot>