-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Playing in iOS/Safari with user interaction not working after server request #618
Comments
I updated the description after some other tests to provide a simple example. @cookpete Thanks |
As far as I can tell, videojs/video.js#4765 pretty much nails it. iOS has a very strict policy on what can start media. In your example it is the resolution of a promise that tries to start playing something, and not a direct user action. Calling I honestly don't know what can be done about this, and looking at the Perhaps |
In any case their issue is related but doesn't fix this use case where we must have this async call before play to get the media data. If I understand correctly they are talking about removing an async code (timeout) they had in their codebase that was causing the issue. The final fix though was to player.load() once they have the video src to make it ready for the user gesture. I don't think their solution works for us because we need that async call for now. Probably we go for the solution where if we find a NotAllowedError we play it as muted. Because after the user successfully plays something with sound, all the other videos/audios work normally. |
This is too much of an assumption to make on behalf of the user. We don't know that devs/users will be happy with the media playing anyway if the browser is not allowing it to play. They might be happy to wait for direct user interaction. It also creates a weird dissonance between props and reality (something is playing muted even though You can probably implement this yourself already: store Edit: Sorry, I assumed you were suggesting |
Yep, we will implement a solution like that, thanks for your help. |
Hi, first of all, thanks for your react-player component. It has helped our team to build different players in our projects but we are running into a big problem that for you may find to be easy to fix but we didn't find any solution yet:
Current Behavior
We have two projects:
https://www.cadena100.es/ and https://www.cope.es/directos/net1
Both of them use ReactPlayer as their's player core (FilePlayer) but we are unable to trigger a video/audio playing after making a server request for the video data. This request is triggered by a user interaction. This problem only happens in iOS and Safari.
We have the error:
NotAllowedError: The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.
This is related to the autoplay policies but we don't want to autoplay them, we just need to play it after a user's interaction on the page that will change the ReactPlayer props after we have the video/audio src that comes from server.
Expected Behavior
I would expect this to just play normally since the click for playing was done in a user interaction on the page.
Example:
If I remove the promise and I just execute setUrl it works normally. Do you know what are we doing wrong?
Thanks in advance.
PD: Maybe related:
videojs/video.js#4765
videojs/video.js#5822
The text was updated successfully, but these errors were encountered: