AgoraIO / Basic-Video-Call

Sample app to join/leave a channel, mute/unmute, enable/disable the video, and switch between front/rear cameras.
MIT License
695 stars 1.01k forks source link

Audio only works with earphones #337

Closed nitsanasraf closed 1 year ago

nitsanasraf commented 1 year ago

I've opened a channel, and I test the connection on my physical iPhone, and on the web demo (https://webdemo.agora.io/basicVideoCall/index.html).

When a remote user joins I call: self.agoraKit?.adjustUserPlaybackSignalVolume(uid, volume: 100) the config when initializing a channel:

 self.agoraKit = AgoraRtcEngineKit.sharedEngine(withAppId: KeyCenter.appID, delegate: self)
                self.agoraKit?.enableVideo()
                let result = self.agoraKit?.setDefaultAudioRouteToSpeakerphone(true)
                print(result)

                let videoCanvas = AgoraRtcVideoCanvas()

                videoCanvas.uid = userUID
                videoCanvas.renderMode = .hidden
                videoCanvas.view = self.frames[self.localFrameIndex!].videoView

                self.agoraKit?.setupLocalVideo(videoCanvas)

on the channel, the camera is working fine, and I can see myself and my laptop on the same channel with video activated, it is just the issue that on my physical iPhone I can hear the remote user only if I connect my airpods to my phone.

(result is returning 0, so what is the issue here?)

Also, when I check isSpeakerphoneEnabled it's returning false. how come?

nitsanasraf commented 1 year ago

Managed to fix it by myself.