Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A lot of providers don't work in an iframe #586

Closed
Maxou44 opened this issue Mar 4, 2019 · 2 comments
Closed

A lot of providers don't work in an iframe #586

Maxou44 opened this issue Mar 4, 2019 · 2 comments

Comments

@Maxou44
Copy link
Contributor

Maxou44 commented Mar 4, 2019

Hello,

I have an issue with the react-player in iframes, the "Play" action don't work (for example on Vimeo, I always have this issue:
Uncaught (in promise) NotAllowedError: play() failed because the user didn't interact with the document first.

You can reproduce the issue with the following code:
<iframe width="100%" height="100%" src="https://cookpete.com/react-player"></iframe>

Choose a Vimeo/Youtube/Soundcloud source and click on the Play button

Any idea?

@Maxou44 Maxou44 changed the title Vimeo: Uncaught (in promise) NotAllowedError: play() failed because the user didn't interact with the document first. A lot of providers can't be called in an iframe Mar 4, 2019
@Maxou44 Maxou44 changed the title A lot of providers can't be called in an iframe A lot of providers don't work in an iframe Mar 4, 2019
@cookpete
Copy link
Owner

cookpete commented Mar 6, 2019

play() failed because the user didn't interact with the document first. is the browser deliberately preventing playing without a user action (eg a click on the video). Autoplay is seen by modern browsers as bad UX and is slowly dying. See various discussions:

@cookpete cookpete closed this as completed Mar 6, 2019
@talibnelson
Copy link
Contributor

I know this issue was closed, but I believe it's valid. I think that the play action fails at times even when the user does interact with the document first ie. a play button that triggers a load and then play. I think the issue stems from the origin receiving permission via the click, but that permission is never delegated to the iframe. https://developers.google.com/web/updates/2017/09/autoplay-policy-changes#iframe I believe this can be fixed for the Soundcloud Player specifically by simply adding allow= 'autoplay' to it's iframe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants