minznerjosh / vast-player

Playback VAST creatives in a web browser.
MIT License
45 stars 32 forks source link

NotAllowedError with autoplay on mobile devices #18

Open matejstrasek opened 5 years ago

matejstrasek commented 5 years ago

We are getting 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. when trying to autoplay on mobile devices.

Anyone knows a workaround for this?

minznerjosh commented 5 years ago

Can you provide some context? Which browser are you seeing this in? Which version of that browser?

kprokopchik commented 5 years ago

I'am getting the same error when trying to autoplay on Safari browser Version 12.0 (14606.1.36.1.9) and also the same error but with different message Uncaught (in promise) DOMException on Chrome browser Version 71.0.3578.98. The Firefox browser allows autoplay without any issues. If I do not implement autoplay and add user interaction like click on a button to play the video then everything works fine. There are a lot of solutions on stackoverflow how to solve Uncaught in promise issue but none of them helped me. Even when I mute the video I still get the same error with Uncaught.

matejstrasek commented 5 years ago

Same as @dhargo: Chrome 71.0.3578.98 and Safari 12.0.2.

Is the library calling manually *.play() somewhere? Could be devices don't like that maybe?

I ended up using pure html video tag instead and handling events we need.

minznerjosh commented 5 years ago

Looks like #19 will fix this.