admin管理员组文章数量:1317898
We are implementing web player which should work across the browsers. We are setting the video source through java script and calling play() to play the video on the browser.
We described Video element as given below.
<video id="videoID" preload="none" tabindex="1"></video>
This is working fine on Chrome but video is not playing on Safari (version : 11.0.3) and throwing Unhandled Promise Rejection error as given below.
Unhandled Promise Rejection: NotAllowedError (DOM Exception 35): The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission
If I change the autoplay setting in safari to 'Allow all Autoplay', video is playing fine with out any issues.
I tried by adding autoplay attribute also to Video element but it is not working.
Expectation is user shouldn't do any thing to play the video. When user visits the URL, it should play the video (with audio) automatically without any user action. Could anyone please let me know if there is anyway to achieve this in javascript?
We are implementing web player which should work across the browsers. We are setting the video source through java script and calling play() to play the video on the browser.
We described Video element as given below.
<video id="videoID" preload="none" tabindex="1"></video>
This is working fine on Chrome but video is not playing on Safari (version : 11.0.3) and throwing Unhandled Promise Rejection error as given below.
Unhandled Promise Rejection: NotAllowedError (DOM Exception 35): The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission
If I change the autoplay setting in safari to 'Allow all Autoplay', video is playing fine with out any issues.
I tried by adding autoplay attribute also to Video element but it is not working.
Expectation is user shouldn't do any thing to play the video. When user visits the URL, it should play the video (with audio) automatically without any user action. Could anyone please let me know if there is anyway to achieve this in javascript?
Share Improve this question edited Feb 5, 2018 at 18:03 kadina asked Feb 5, 2018 at 17:57 kadinakadina 5,3667 gold badges54 silver badges99 bronze badges 01 Answer
Reset to default 6As far as I know this cannot be achieved via Javascript alone. On safari (without the setting you mentioned) a video can only be started via a user interaction. This is to avoid videos auto-playing against a user's will.
本文标签:
版权声明:本文标题:html - Video play() api in javascript is not working in safari until I change the preference of autoplay to 'Allow all A 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742036290a2417312.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论