简体   繁体   中英

How to change the audio output from speaker phone to earpiece in flutter android?

I'm using flutter_webrtc package for audio call functionality of my app and by default the audio output is on speakerphone how can I change the speaker phone to earpiece in flutter.

By analysing the code I used this method which is method in RTCVideoRenderer class called audioOutput but it throws unImplementedError .

You must use the enableSpeakerphone method in the MediaStreamTrack class like this

android manifest

<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
currentRender.srcObject?.getAudioTracks()[trackIndex].enableSpeakerphone(boolean);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM