MediaStream Unhandled Promise Rejection: [object DOMError] (in Safari 11)

末鹿安然 提交于 2019-12-05 17:47:42

Safari 11 blocks from autoplay any video with sound by default (source).

I believe the video element comes with the autoplay attribute. When you set srcObject to it, it will try to play the video -- and then got blocked by Safari. That's why you see the error.

You can try to remove autoplay from the video element, then you may be able to catch it in playPromise.catch.

I don't know if this can work for you but I had a similar issue, the fix was add the 'muted' attribute to the video tag, after that everything is working again, hope it helps.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!