如题,突然发现浏览器里无法播放视频了,就是控件直接看不到, android可以.
连上mac用safari远程调试看到下面这个异常,
[Error] Unhandled Promise Rejection: NotAllowedError: The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.
(anonymous function)
rejectPromise
play
play (cocos2d-js-for-preview.js:40881)
play (cocos2d-js-for-preview.js:40605)
play (cocos2d-js-for-preview.js:18977)
videoPlayerEvent (VideoPlayer.js:74)
emit (cocos2d-js-for-preview.js:14882)
emitEvents (cocos2d-js-for-preview.js:14867)
onMetaLoaded (cocos2d-js-for-preview.js:18953)
onMetaLoaded
_dispatchEvent (cocos2d-js-for-preview.js:40653)
onloadedmetadata (cocos2d-js-for-preview.js:40813)
查了下资料貌似是苹果去年新增的限制?
https://webkit.org/blog/7734/auto-play-policy-changes-for-macos/
https://github.com/jwplayer/jwplayer/issues/2421
https://www.reddit.com/r/webdev/comments/71nkym/safari_11_has_a_major_change_to_web_audio_api/
不知道是不是跟这个有关系…