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

Usage of audio check in muted tab only works first call #52

Open
davija opened this issue Dec 16, 2022 · 3 comments
Open

Usage of audio check in muted tab only works first call #52

davija opened this issue Dec 16, 2022 · 3 comments

Comments

@davija
Copy link

davija commented Dec 16, 2022

Working with version 3.0.2, I have a call to the canAutoplay.audio() which correctly yields false when called the first time. However subsequent calls always return true.

Tried with chrome: Version 108.0.5359.98 (Official Build) (64-bit) on Linux, Chrome on android tablet and the behavior is the same. First call works like it should, second call always returns true.

@gkatsev
Copy link
Member

gkatsev commented Dec 16, 2022

I think I can reproduce. I added a "rerun tests" button to the example page and I have all autoplay blocked in Firefox and while it fails on the first run, all the tests pass on the second run.

I can take a look at some point, but PRs would be greatly appreciated!

@davija
Copy link
Author

davija commented Dec 16, 2022

Thanks for posting the link to the test. Oddly enough, I wasn't getting those error messages in Chrome. When I checked the link it gave in the message I think I found the clue as to why it is doing this...

According to the link, autoplay is disabled until the user interacts with the document. By clicking on the rerun button the user is "interacting" with the document so, autoplay is allowed? (only guessing here). This is the same kind of situation I had, the initial test happened when the page was loaded and then when the user clicks a link it re-ran the test.

I think maybe a good test to verify this would be to have a timer setup to re-run the test on intervals when the page loads. If my suspicions are correct the timer would return false every time since the test is running without any prior user interaction.

@gkatsev
Copy link
Member

gkatsev commented Dec 17, 2022

Ah, that's true. Chrome does take document interaction into account.
For me, adding a timer locally, I do see the same results in Chrome on the rerun.
Screen Shot 2022-12-16 at 19 29 07

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

2 participants