-
Notifications
You must be signed in to change notification settings - Fork 572
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
Change Play Audio Device there is a chance that it will fail #2111
Comments
Handling the unplugging or plugging in of peripherals has been a major problem area. Also sometimes the low level code may not repond to the headset being changed. I recommend:
|
Ok, thank you very much for your reply, but I have a question, if I don't use |
After you get an onErrorCallback(), you should open a new stream. You should get an onErrorCallback() when a headset is connected/disconnected. |
emmm, Whether I switch playback devices or recording devices, should I reopen the stream in the onErrorCallback() ? And then, in the configuration of reopening the stream, do not fill in the deviceID, so that OBOE can select a device by itself? |
That should be fine. Android should prioritize the external playback and recording devices over the built-in speaker/mic. |
Android version(s): Android 13
Android device(s): Mi 11 Ultra
Oboe version: 1.9.2
App name used for testing:
(Please try to reproduce the issue using the OboeTester or an Oboe sample.)
Short description
(Please only report one bug per Issue. Do not combine multiple bugs.)
When I use the speaker to play, and then plug in the wired headphones, there is a probability that the headphones will fail to play.
Steps to reproduce
audioManager?.registerAudioDeviceCallback()
in the application layer. When a wired headset is detected, stop and release of oboe are called in sequence to destroy the previous instance, and then reopen and start it again.Expected behavior
Sound plays from headphones
Actual behavior
No sound from headphones
Device
Please list which devices have this bug.
If device specific, and you are on Linux or a Macintosh, connect the device and please share the result for the following script. This gets properties of the device.
Any additional context
In the log, we can actually see that when the restart switched to wired headphones, it was successful:
But then there will be a callback from the bottom layer, as follows:
At this time, the headset is not unplugged from the phone, but it receives the callback of onAudioDeviceUpdate. At this time, it will be from the device(1211) of the wired headset -> the device(3) of the speaker, and then there will be another one from the device(3) of the speaker -> the device(1211) of the wired headset. Then, because onError is thrown at this time, if onError returns false, then in oboe, it will stop and close it. At this time, there is no sound in the wired headset.
I saw a similar question asked before. How to handle audio output device change?.
have seen: SimpleMultiPlayer::startStream and SimpleMultiPlayer::MyErrorCallback::onErrorAfterClose
Is this to avoid switching device failure?
Looking forward to your reply, thank you
If applicable, please attach a few seconds of an uncompressed recording of the sound in a WAV or AIFF file.
The text was updated successfully, but these errors were encountered: