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

Music stops playing in background on iOS #19

Open
stefandesu opened this issue Apr 16, 2021 · 3 comments
Open

Music stops playing in background on iOS #19

stefandesu opened this issue Apr 16, 2021 · 3 comments

Comments

@stefandesu
Copy link

I found your project yesterday and I love it! Unfortunately, the music stops playing as soon as you put the PWA in the background on iOS. The thing is that I once researched this particular issue and it seems like this is an iOS restriction/bug that prevents it, so there might be nothing you can do.

However, I also noticed that the same thing happens in Safari on iOS (i.e. not installed as a PWA). In theory, sites in Safari should be able to play music in the background, at least that was my conclusion from the research I've done one.

Might be something to look into.

@maxence-charriere
Copy link
Owner

maxence-charriere commented Apr 16, 2021

the music stops playing as soon as you put the PWA in the background on iOS

Unfortunately, this is a limitation related to all web browsers on mobile. Even when pinned on the home screen, it is still Safari that is running it.

Also, it is a Youtube video in the background but since I wanted the content you be embedded in the UI, I deactivated the feature that launches the video in full screen so there is no in picture mode.

@stefandesu
Copy link
Author

Unfortunately, this is a limitation related to all web browsers on mobile. Even when pinned on the home screen, it is still Safari that is running it.

Okay so I haven't researched the technical details about this, but it is definitely possible to play audio in the background through Safari on iOS. That's what I found out back then: You can play audio in the background in a browser tab in Safari (example: https://epidemicsound.com), but not inside a PWA that was added to the home screen (I don't have an example to show this behavior, but back then I tested it with a simple example I made myself).

I guess since you are using a YouTube video embed, it will stop playing as soon as it goes in the background. The same happens with YouTube videos playing through the YouTube website in Safari. So I guess there's no way around this. Too bad. 😕

@maxence-charriere
Copy link
Owner

Yeah, it is a bummer but it is a limitation but also, I was thinking of hacking something like put the video in in-picture mode when the app loses focus but Youtube is blocking that mode if you are not a premium user.

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