-
Notifications
You must be signed in to change notification settings - Fork 5k
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
[expo-av][iOS] Lock screen controls not working #4171
Comments
Hi @redpandatronicsuk , Shouldn't this be posted to the If you are using Expo APIs, then please include all your steps, and (preferably) a reproducible demo 😄 Thanks! |
Hi @cruzach, What is wrong with what I wrote in the Steps to Reproduce section?
I thought the issue is with I'll leave this issue open until the issue is resolved, if that is OK. Cheers, |
Hi @redpandatronicsuk - it helps a ton to have a reproducible demo, as @cruzach mentioned. Like this one here you included here: #3935. Can you re-open when you've updated with that? Thanks a ton, esp for your quick responses! |
Hi @expjess, sorry for taking long to get back this time, haven't had much time to work on this. I've opened an issue with Also, many thanks for publishing |
Hi @expjess, I misread your last comment. I thought you were going to re-open the issue once I add the reproducible demo. I don't know how I can re-open the issue, maybe I don't have the privileges? If you have permissions, could you please re-open it? Thanks |
I just updated the dependencies the the repo with the sample code for this issue (https://github.com/redpandatronicsuk/expoavtest) now using |
@expjess any chance you could re-open this please? |
I've added With I would appreciate it if you could have a look at that workaround and tell me whether it is safe to use or not. |
I've found another workaround to make lockscreen controls work. This time I think I found an actual bug in In |
@redpandatronicsuk I have the same issue; thanks for digging into this. If I'm understanding your linked repro project, the workaround appears to be a patch to the EXAV pod - how do you maintain that patch and avoid a future Also, you mentioned two different workarounds in your last two comments, but I could only find one workaround described - the aforementioned EXAV patch. Could you describe the first workaround you mentioned? Or maybe just compare the two? |
Hi @brettdh, I only maintain the patch by hand, i.e. after The workarounds:
So patch 1 keeps the Audio Session active, but the patch is logically wrong, as this function should not return Patch 2 I think is the right approach, see the comments inlines 819-823 in the above referenced file Hope that helps :) |
Perfect, thank you! I found the wonderful patch-package tool and saved your second patch for now. ✨ |
Thanks man, patch-package looks great! |
Any word on this being officially fixed? (I am also experiencing this issue using |
I am also getting same issue with ios |
Sorry everyone, looks like this was lost in the weeds I'd need to look more into this to see if the issue lies with |
Came across the same issue. What seems to be working for me is setting In other words, before playback, try calling the following: Audio.setAudioModeAsync({
allowsRecordingIOS: false,
staysActiveInBackground: true,
interruptionModeIOS: Audio.INTERRUPTION_MODE_IOS_DO_NOT_MIX,
playsInSilentModeIOS: true,
shouldDuckAndroid: true,
interruptionModeAndroid: Audio.INTERRUPTION_MODE_ANDROID_DO_NOT_MIX,
playThroughEarpieceAndroid: false
}); |
@cruzach sorry, I haven't seen your message earlier, but thanks for getting work on this issue started again. Can you please look at what I have written earlier in this tread. I am providing a workaround in the issue description all the way at the top. I also made a reproducible demo here: https://github.com/redpandatronicsuk/expoavtest Thanks |
Seems like your second comment is accurate, would you like to open a PR for this? |
Have the same issue with expo-av 8.1.0. Is there any information when it will be fixed? |
I've been debugging this to see whether we can get this fixed. What I've found so far is that with the latest
This check does not allow audio to be played when the app is in the background. When disabling this check it starts working though. |
🐛 Bug Report
I am using
react-native-music-control
for lock screen controls when playing audio in background mode. The pause button on the lock screen works, but when play is pressed again, it does not resume playing. When the function that listens to the lock screen play button press runs, it says that there is no active sound session.A a workaround, having this function:
expo/packages/expo-av/ios/EXAV/EXAVPlayerData.m
Line 359 in 491dde5
always return
true
results in the lock screen controls working.The app I am working on is already in production. Is it safe to use this workaround as a temporary fix to get lock screen controls working?
Environment
Expo CLI 2.17.1 environment info:
System:
OS: macOS 10.14.4
Shell: 5.3 - /bin/zsh
Binaries:
Node: 11.10.1 - ~/.nvm/versions/node/v11.10.1/bin/node
Yarn: 1.15.2 - /usr/local/bin/yarn
npm: 6.7.0 - ~/.nvm/versions/node/v11.10.1/bin/npm
Watchman: 4.9.4 - /usr/local/bin/watchman
IDEs:
Android Studio: 3.4 AI-183.5429.30.34.5452501
Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.3 => 16.8.3
react-native: 0.59.5 => 0.59.5
react-navigation: 3.9.1 => 3.9.1
npmGlobalPackages:
expo-cli: 2.17.1
iOS
Steps to Reproduce
Create new app with bare template -> add
react-native-music-control
as dependency -> configureMusicControl.on('play', ...)
andMusicControl.on('pause', ...)
and other required configurations -> play a sound -> whilst sound is playing lock the device -> on the lock screen press pause -> on the lock screen press play, this should print no active sound session... to error logExpected Behavior
In the section above, the last step should resume the paused sound, rather than printing an error to the log
Actual Behavior
The last step two section above, i.e. printing to the error log that there is no active av session
Reproducible Demo
https://github.com/redpandatronicsuk/expoavtest
The text was updated successfully, but these errors were encountered: