禁止自动播放音频视频有时候失效

阅读:4434回复:2
2021-11-01 10:06
写私信
楼主#
百度贴吧不知道用了什么方法,绕过了禁止音频视频自动播放的设置,比如一些游戏贴吧里玩家的录屏,在帖子列表鼠标滑过就会自动播放,在帖子里不会。举个例子
https://tieba.baidu.com/p/7575781632
https://tieba.baidu.com/f?kw=%E6%96%B9%E8%88%9F%E7%94%9F%E5%AD%98%E8%BF%9B%E5%8C%96&ie=utf-8&tp=0&pn=50
这个贴吧里   就有个别会自动播放
2021-11-03 20:44
写私信
1楼#
about:config 中将 media.autoplay.blocking_policy 设置为 1 就好。
默认 0,比较宽松,某些情况下鼠标划过被认为有用户交互,是有点误判。

关于取值
This pref defines what the blocking policy would be used in blocking autoplay.
0 : use sticky activation (default) https://html.spec.whatwg.org/multipage/interaction.html#sticky-activation
1 : use transient activation (the transient activation duration can be adjusted by the pref `dom.user_activation.transient.timeout`) https://html.spec.whatwg.org/multipage/interaction.html#transient-activation
2 : user input depth (allow autoplay when the play is trigged by user input which is determined by the user input depth)
2021-11-05 21:38
写私信
2楼#
发现有个很神奇的现象,地址栏前边那里设置成阻止音频视频,然后值设为1,视频仍然会播放,但是没声音