我想使用JavaScript将YouTube视频设置为网页内的块背景。在那里,我需要视频以全屏模式播放。另外,我还需要提供自动播放,循环播放和静音等选项。
我有一个脚本,可以给背景视频提供循环和自动播放功能,但不能提供全角和静音功能。在我的脚本中,我生成了一个类似以下示例代码的iframe
<iframe width="420" height="315" src="http://www.youtube.com/embed/youtube_id_here?autoplay=1&loop=1">
</iframe>
如何设置具有自动播放,全角,循环和静音功能的代码。
请帮忙
最佳答案
看这段代码
<div style="position: fixed; z-index: -99; width: 100%; height: 100%">
<iframe frameborder="0" height="100%" width="100%"
src="https://youtube.com/embed/gkTb9GP9lVI?autoplay=1&controls=0&showinfo=0&autohide=1">
</iframe>
</div>
关于javascript - YouTube视频背景以阻止网页内,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31514271/