【发布时间】:2019-07-07 04:28:27
【问题描述】:
我正在使用 soundcloud 嵌入 iframe 代码。 soundcloud 有自动播放音频的选项,它在 iframe src 属性中定义为 &auto_play=true url 参数。
但是还有其他 iframe 属性 allow="autoplay 'none'" 不允许 iframe 播放该音频,并且它在 Firefox 中不起作用。
https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide#Example_Disabling_autoplay
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#Browser_compatibility
HTML:
<iframe width="100%" height="300" scrolling="no" frameborder="no" allow="autoplay" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/148714961&color=%23ea00ff&auto_play=true&hide_related=false&show_comments=true&show_user=true&show_reposts=false&show_teaser=true&visual=true"></iframe>
https://codepen.io/balancana/pen/WPKjoE
问题是我想停止 soundcloud iframe 音频文件播放
不管auto_play url参数是什么。
【问题讨论】:
-
只需删除
allow属性。默认情况下,它会因不存在而被禁用。 -
@zer00ne 嗯,但它仍然会在 Firefox 中自动播放 codepen.io/balancana/pen/OdwjwP Firefox 有什么解决方法吗?
-
ATM 这个lame plugin 是个人用户的解决方案,但对于那里的开发人员ain't no such thang
标签: html firefox iframe soundcloud