3

我在 这个网站上使用 YTplayer 插件作为全屏 youtube 播放器获取灵感选项卡!

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

播放器


有用的链接>>


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 脚本。
4

1 回答 1

2

编辑

似乎问题来自回购jquery.mb.YTPlayer。如果我们看问题https://github.com/pupunzi/jquery.mb.YTPlayer/issues/49

确保您拥有最新版本的 repo。


从 repo 中阅读文档后,尝试替换 : autoPlay: true,byautoplay: 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

于 2014-08-26T13:12:50.373 回答