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

Youtube autoplay not working in background tab (again?) #1187

Closed
dj-mothman opened this issue Mar 8, 2021 · 0 comments
Closed

Youtube autoplay not working in background tab (again?) #1187

dj-mothman opened this issue Mar 8, 2021 · 0 comments

Comments

@dj-mothman
Copy link

In issue #1072 the user describes behaviour where they are able to have a youtube video automatically play at the end of the previous youtube video, even if the user is in a different tab. However, in my project I'm not able to reproduce this behaviour.

My app basically works like this:

  1. User connects to the front end and adds a song to the queue
  2. Back end detects this and sets the "currently playing" song in the database
  3. Front end detects that the "currently playing" song has been updated and stores it in state
  4. ReactPlayer url prop is updated based on the url of the "currently playing" song in state
  5. Song ends, back end detects this and sets the "currently playing" song to the next song in the queue
  6. Repeat 3-5 until queue is empty

This is all working fine when the user has the tab focused, but if the user goes to another tab, then when the current song finishes the next song won't play automatically. If the user opens the tab again then the video starts playing as expected. Currently I'm only using youtube videos, so there is no effect from having different players etc.

While investigating, I came across issue #7 which suggests that this may have been an issue which was fixed back in 2015, and as I said issue #1072 seems to suggest that this was working as expected as recently as November 2020. Because of this I feel like there must be a problem with the way that I have written my front end which is stopping this behaviour from working, but having tried a few different things (messing with playing prop and onStart/onPause handlers etc.) nothing I do seems to have any effect.

Is it possible that there been a recent change to the way google chrome's autoplay policy works which has broken this functionality?

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

1 participant