I’m developing a video calling feature in my Flutter app using the Agora SDK. I’m encountering an issue where the call audio doesn’t default to the speaker when the call is initialized. Here’s what I’ve tried:
await _engine.setEnableSpeakerphone(true);
I’m calling this method right after joining the channel:
agoraEventHandlers: AgoraRtcEventHandlers(
onLocalUserRegistered: (uid, userAccount) {},
onJoinChannelSuccess: (connection, int elapsed) async {
try{
await client?.engine.setEnableSpeakerphone(true);
}catch(e){
logMsg.add("setEnableSpeakerphone : ${e.toString()}");
showSnackMsgSnackBar();
}
try{
isSpeaker = (await client?.engine.isSpeakerphoneEnabled()) ?? false;
setState(() {});
if (!isSpeaker) {
Fluttertoast.showToast(
msg: "Turn on Speaker",
toastLength: Toast.LENGTH_SHORT,
gravity: ToastGravity.BOTTOM,
timeInSecForIosWeb: 2,
);
}
}catch(e){
logMsg.add("isSpeakerphoneEnabled : ${e.toString()}");
showSnackMsgSnackBar();
}
},
However, when the call starts, it’s still using the earpiece instead of the speaker. I’ve also tried: