Unity-Technologies / furioos-sdk-js

Furioos SDK for JavaScript
30 stars 14 forks source link

Autoplay Video blocked by Browser? #30

Closed valeriosillari closed 3 years ago

valeriosillari commented 3 years ago

Hello, I'm implementing Furioos player on a web page and I'm trying to get the video starting without the user has to click on the play button.

So as first step I've hidden the play button with the option "hidePlayButton: true".

Then, when player is loaded o the page I start the player player.onLoad(function() { // Here you know when the player is ready. player.start(); })

Until here all good. Player is started.

But then I cannot see the "real video" starting, but I got a message from the browser (Chrome)

Screenshot 2020-12-02 at 10 57 01

I know this a normal behaviour from modern browser to avoid autoplaying.

Just wondering if there are: 1 some option to bypass it (in the player sdk itself) 2 or if my logic steps are correct 3 or there are some strategies you suggested for solving this issue.

Could you give me some support or tips? :)

peettee commented 3 years ago

Not that I know of. I think an explicit user gesture is required for the video playback to start. What I ended up doing was hiding the play button but introducing another button by myself and then loading the player in the onclick method of the button. That way the autoplay warning is at least not displayed and I can display my own message with different wording (customers might get scared by the default message)

valeriosillari commented 3 years ago

Thanks for the answer. I will check how to move forward, probably a custom button as you've suggested