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

still can't make playlists work (autoplay policy ?) #1177

Closed
gordielachance opened this issue Feb 18, 2021 · 2 comments
Closed

still can't make playlists work (autoplay policy ?) #1177

gordielachance opened this issue Feb 18, 2021 · 2 comments

Comments

@gordielachance
Copy link

Related to #1072, I still can't make playlists work; player is "blocked" by the browser when the tab is inactive.

I suspect that this might be related to your code, since it even does not work when the website is whitelisted for autoplay (for chrome, at chrome://settings/content/sound).

This example on codepen has an audio playlist which works when tab is in background (even if not whitelisted) https://codepen.io/danielhoegel/pen/OZNqNo

After a media has ended and that the next one is requested to play (custom code), react-player fires onReady but does not play the media.

Other Information

Demo here : http://v2.spiff-radio.org/
I also filled a question on stackoverflow here.

Thanks a lot !

@TheManFromEarth1
Copy link

TheManFromEarth1 commented Feb 18, 2021

With your demo it doesn't work here on either Firefox or Chrome.

I use the library on a Nextjs project and there it autoplays the next video also when in background.

I use onEnded={..} which calls a function which updates the current url={...}.

// I have also set this:
stopOnUnmount={false}

@gordielachance
Copy link
Author

Hi @TheManFromEarth1, it helped !
As I knew it was possible because of your feedback, I kept trying to find out what was the bug.

Well, at the beginning of my function resolveTracks(), I had a line

setSourceUrl('');

Which was "resetting" the stream before loading the next URL.
That was the cause of my bug. Without that line, going to the next track works !

Thanks a lot for your help.
(no need for stopOnUnmount here)

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