-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[WIP] Add selectAudioOutput method. #1030
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
Conversation
5e25c2e
to
e941e12
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about choose some common formatter rules (with configs for popular IDEs)?
android/src/main/java/com/cloudwebrtc/webrtc/audio/AudioSwitchManager.java
Outdated
Show resolved
Hide resolved
android/src/main/java/com/cloudwebrtc/webrtc/audio/AudioDeviceKind.java
Outdated
Show resolved
Hide resolved
android/src/main/java/com/cloudwebrtc/webrtc/MethodCallHandlerImpl.java
Outdated
Show resolved
Hide resolved
android/src/main/java/com/cloudwebrtc/webrtc/audio/AudioSwitchManager.java
Outdated
Show resolved
Hide resolved
I used to add a clang-format styles file https://github.com/flutter-webrtc/flutter-webrtc/blob/main/.clang-format, but also need to add relevant formatting validation in CI. |
It seems that flutter engine rather specific on this point - CONTRIBUTING. |
@cloudwebrtc Can I add to this as well; on iOS there's no external microphone to select, only the internal one. Makes the whole library useless since a lot of people use airpods for video calls etc. (phone in the pocket, meeting booths, on-the-go, etc) Calling
Only the built-in microphone is returned Tested on Mac/Web and it works just fine, on iPad and iPhone it breaks. |
More another story for the audio input issue #1041 |
@ycherniavskyi It seems that iOS can't enumerate all audio outputs devices and can't select output devices, do you have any ideas? @OllyDixon Perhaps we have to hand over control of output to the system on iOS, and the only thing we can do is select the speaker or the currently preferred output. |
@cloudwebrtc I will check this PR today and write my thoughts. |
e4cb77a
to
1dac603
Compare
…putDevice (#933) * Implementation returns a list of audio sources,imp fun setPreferredInputDevice * format code
@cloudwebrtc I see you merged it, is it now ready for all devices? 🚀 |
@OllyDixon Yes, all platforms can choose the output device, |
@cloudwebrtc great work, thanks! 🚀 |
@@ -980,14 +988,14 @@ public String peerConnectionInit(ConstraintsMap configuration, ConstraintsMap co | |||
if (mPeerConnectionObservers.size() == 0) { | |||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S | |||
|| context.getApplicationInfo().targetSdkVersion < Build.VERSION_CODES.S) { | |||
audioManager.onAudioManagerRequested(true); | |||
//audioSwitchManager.start(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look strange that this if execute nothing. I didn't know if we need to start the manager or not. But having a if that does nothing seems useless
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I rechecked the code, this piece should be able to be removed,
audioSwitchManager has already called start when it is created, and start is only used to monitor device changes, so it will not take over the audio route
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this Bluetooth permission necessary?
...
ArrayList<String> permissions = new ArrayList<>();
permissions.add(Manifest.permission.BLUETOOTH_CONNECT);
requestPermissions(
permissions,
(args) -> {
//audioSwitchManager.start();
},
(args) -> {
});
}
}
...
I'm getting requested access for nearby devices but from my understanding, this shouldn't be required. My app does not require bluetooth.
Can it be removed? If not, is there a way to prevent this line from being called?
Thanks in advance!
@@ -1545,7 +1567,7 @@ public void peerConnectionDispose(final String id) { | |||
mPeerConnectionObservers.remove(id); | |||
} | |||
if (mPeerConnectionObservers.size() == 0) { | |||
audioManager.onAudioManagerRequested(false); | |||
//audioSwitchManager.stop(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as my previous comments @cloudwebrtc
Is there an example code that we can refer regarding routing audio between Bluetooth and speakerphone |
How can we achieve this? |
UPDATE:
Upstream dependencies have been upgraded, Need to be implemented in this PR
Future<MediaDeviceInfo> selectAudioOutput([AudioOutputOptions? options]); 8000
We must first implement
MediaDevices.enumerateDevices
to get output devicesWebuse RTCVideoRenderer.audioOutput insteadFunction(dynamic event)? ondevicechange
MediaDevices.enumerateDevices