bilibili / flv.js

HTML5 FLV Player
Apache License 2.0
22.89k stars 3.39k forks source link

DOMException: play() failed because the user didn't interact with the document first #531

Open gongll opened 4 years ago

gongll commented 4 years ago

if (flvjs.isSupported()) { const { video } = this; const flvPlayer = flvjs.createPlayer({ type: 'flv', isLive: true, url: 'http://172.31.140.14/oflaDemo/flv/qingcare001', }); flvPlayer.attachMediaElement(video); flvPlayer.load(); flvPlayer.play(); }

wss1942 commented 4 years ago

浏览器不允许自动播放视频,必须有一次用户交互。可以把 flvPlayer.play() 当到一个按钮的点击事件中,点击按钮时播放视频。

lynxerzhang commented 4 years ago

331 这里有讨论

zlwleng commented 4 years ago

静音就可以了