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

Prevent errors other than autoplay errors from muting video #740

Merged
merged 3 commits into from
Sep 8, 2024

Conversation

robtpaton
Copy link
Contributor

@robtpaton robtpaton commented Aug 17, 2024

What
When there is a playback error, try to determine if it is an autoplay error before trying to play the video muted.

Why
Fixes #529 (at least in Chrome browsers).

When debugging #529 locally, I found many different playback errors get caught in the catch block (e.g The play() request was interrupted by a new load request.). In these cases we don't want to mute the video, so I added a conditional to only unmute if the error is related to autoplay.

After this change, I can successfully load a view with the video unmuted, in both Chrome Desktop and the Android Companion App. Safari is harder to fix because both autoplay and non-autoplay errors are reported as AbortError.

@robtpaton robtpaton force-pushed the better-autoplay-behaviour branch from 1eb4ef0 to 607f0bb Compare August 17, 2024 13:52
@AlexxIT AlexxIT self-assigned this Sep 3, 2024
@AlexxIT AlexxIT merged commit 2aef88b into AlexxIT:master Sep 8, 2024
2 checks passed
@AlexxIT
Copy link
Owner

AlexxIT commented Sep 8, 2024

Thanks!

@AlexxIT AlexxIT added this to the v3.6.0 milestone Sep 8, 2024
AlexxIT added a commit that referenced this pull request Sep 8, 2024
@AlexxIT
Copy link
Owner

AlexxIT commented Oct 12, 2024

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

Successfully merging this pull request may close these issues.

muted option makes no difference
2 participants