YouTube 嵌入不会在初始加载时自动播放。将在刷新时自动播放
YouTube embed doesn't autoplay on initial load. Will autoplay on refresh
这是存在问题的实时网站:thebishops.band
当我设置 mute=1
时,初始加载时 autoplay
有效。但是我需要播放音频。
使用 data-property
与 <iframe/>
。
这里是 html:
<section class="intro full-width full-height jIntro" id="anchor00">
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="playerVideo" data-property="{videoURL:'LH-Jm6QdebU',showControls:false,containment:'self',autoPlay:1, mute:false, startAt:0,opacity:1,ratio:'4/3', addRaster:true}"> <!-- Slider -->
<a href="#" class="play-video">Play/Pause</a>
</div>
</div>
</div>
</div>
</section>
感谢您的帮助。
通过最近的 YouTube API 更新和 browsers vendor policy,您不能
如果音频打开,则自动播放视频。以下是更新的摘录:
Chrome's autoplay policies are simple:
Muted autoplay is always allowed.
Autoplay with sound is allowed if:
- User has interacted with the domain (click, tap, etc.).
- On desktop,
the user's Media Engagement Index threshold has been crossed, meaning
the user has previously play video with sound.
- On mobile, the user has
[added the site to their home screen]. Top frames can delegate
autoplay permission to their iframes to allow autoplay with sound.
我相信您正在使用 jquery.mb.YTPlayer 库。它有一个解决方法,如果自动播放设置为 true 并且音频未静音,则一旦用户与页面进行第一次 click/touch 交互,视频就会开始。
这是存在问题的实时网站:thebishops.band
当我设置 mute=1
时,初始加载时 autoplay
有效。但是我需要播放音频。
使用 data-property
与 <iframe/>
。
这里是 html:
<section class="intro full-width full-height jIntro" id="anchor00">
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="playerVideo" data-property="{videoURL:'LH-Jm6QdebU',showControls:false,containment:'self',autoPlay:1, mute:false, startAt:0,opacity:1,ratio:'4/3', addRaster:true}"> <!-- Slider -->
<a href="#" class="play-video">Play/Pause</a>
</div>
</div>
</div>
</div>
</section>
感谢您的帮助。
通过最近的 YouTube API 更新和 browsers vendor policy,您不能 如果音频打开,则自动播放视频。以下是更新的摘录:
Chrome's autoplay policies are simple:
Muted autoplay is always allowed.
Autoplay with sound is allowed if:
- User has interacted with the domain (click, tap, etc.).
- On desktop, the user's Media Engagement Index threshold has been crossed, meaning the user has previously play video with sound.
- On mobile, the user has [added the site to their home screen]. Top frames can delegate autoplay permission to their iframes to allow autoplay with sound.
我相信您正在使用 jquery.mb.YTPlayer 库。它有一个解决方法,如果自动播放设置为 true 并且音频未静音,则一旦用户与页面进行第一次 click/touch 交互,视频就会开始。