【问题标题】:YouTube fullscreen background autoplay not working in YTplayerYouTube 全屏背景自动播放在 YTplayer 中不起作用
【发布时间】:2014-10-19 09:17:01
【问题描述】:

我正在将 YTplayer 插件用于全屏 youtube 播放器 this-website 获得灵感标签!

  • 我在下面提供了带有有用链接的代码!我认为代码是正确的!
  • 如果我们点击视频播放器底部悬停的播放控件,播放器正在工作!(下图)!
  • 请帮我弄清楚为什么自动播放不起作用?
  • 我的代码哪里出错了?


有用的链接>>


https://github.com/pupunzi/jquery.mb.YTPlayer

http://pupunzi.open-lab.com/mb-jquery-components/jquery-mb-YTPlayer/

http://pupunzi.com/#mb.components/mb.YTPlayer/YTPlayer.html


这里是代码>>


<a class="player" id="player" data-property="{
               videoURL: 'https://www.youtube.com/watch?v=j9fgbuH0_RI&feature=youtu.be',
               containment:'#videobg',
               autoPlay: true,
               optimizeDisplay: true,
               showControls: true,
               startAt: 0,
               opacity: 1,
               ratio: '4/3', 
               addRaster: false }"></a>

            <div id="videobg" class="section-divider white-text videobg" data-scroll-index="4">
                <div class="pattern-overlay"></div>
                <div class="triangle-right"></div>

                <div class="container extra-padding">
                    <div class="col-md-5 extra-padding">
                        <h1>INNOVATING THROUGH TRAVEL</h1>
                        <p>Travel is more than the seeing of sights; it is a change that goes on, deep and permanent, in the ideas of living.</p>
                    </div>
                </div>
            </div>

解决方案

  • 为 ytplayer 使用最新版本的 java 脚本。

【问题讨论】:

  • Please help me to sort out issue! 有什么问题?
  • 自动播放不起作用!明确问题的标题!
  • 你不认为问题出在 repo pupunzi 而不是来自 API 吗?
  • 不知道!只是卡在这一点上!
  • 从 API 自动播放就像一个魅力,现场示例 jsbin.com/cocatuta/26

标签: javascript jquery youtube youtube-api ytplayer


【解决方案1】:

编辑

似乎问题出在 repo jquery.mb.YTPlayer。 如果我们看问题https://github.com/pupunzi/jquery.mb.YTPlayer/issues/49

确保您拥有最新版本的存储库。


从 repo 中阅读文档后,尝试将 autoPlay: true, 替换为 autoplay: true,

最终代码:

<a class="player" id="player" data-property="{
   videoURL: 'https://www.youtube.com/watch?v=j9fgbuH0_RI&feature=youtu.be',
   containment:'#videobg',
   autoplay: true,
   optimizeDisplay: true,
   showControls: true,
   startAt: 0,
   opacity: 1,
   ratio: '4/3', 
   addRaster: false }"></a>

<div id="videobg" class="section-divider white-text videobg" data-scroll-index="4">
    <div class="pattern-overlay"></div>
    <div class="triangle-right"></div>

    <div class="container extra-padding">
        <div class="col-md-5 extra-padding">
            <h1>INNOVATING THROUGH TRAVEL</h1>
            <p>Travel is more than the seeing of sights; it is a change that goes on, deep and permanent, in the ideas of living.</p>
        </div>
    </div>
</div>

文档:https://github.com/pupunzi/jquery.mb.YTPlayer/wiki

【讨论】:

  • 哦,你看到了新链接!等等
  • 非常感谢!刚刚更换了新的 jquery.mb.YTPlayer.js!它奏效了!
猜你喜欢
  • 1970-01-01
  • 2019-03-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-11-21
  • 2012-12-26
  • 1970-01-01
  • 2018-10-17
相关资源
最近更新 更多