awslabs / amazon-kinesis-video-streams-webrtc-sdk-ios

iOS SDK for interfacing with the Amazon Kinesis Video Streams Signaling Service.
Apache License 2.0
66 stars 29 forks source link

Speaker issue #72

Closed Bhoon-coding closed 1 year ago

Bhoon-coding commented 1 year ago

I wonder why the speaker is not working in master phone (I peered iphone to iphone) I tried to test speaker phone when streaming with below code that you guys provided. but It didn't work. any suggestion for this?

 func configureAudioSession() {
        let audioSession = RTCAudioSession.sharedInstance()
        audioSession.isAudioEnabled = true
            do {
                try? audioSession.lockForConfiguration()
                // NOTE : Can remove .defaultToSpeaker when not required.
                try
                    audioSession.setCategory(AVAudioSessionCategoryPlayAndRecord, with:.defaultToSpeaker)
                try audioSession.setMode(AVAudioSessionModeDefault)
                // NOTE : Can remove the following line when speaker not required.
                try audioSession.overrideOutputAudioPort(.speaker)
                //When passed in the options parameter of the setActive(_:options:) instance method, this option indicates that when your audio session deactivates, other audio sessions that had been interrupted by your session can return to their active state.
                try? AVAudioSession.sharedInstance().setActive(true, with: .notifyOthersOnDeactivation)
                audioSession.unlockForConfiguration()
            } catch {
              print("audioSession properties weren't set because of an error.")
              print(error.localizedDescription)
              audioSession.unlockForConfiguration()
            }

    }
sirknightj commented 1 year ago

I think this is the same as #75. Will track there.

From the current sample (without any code changes), the audio comes out of the earpiece speaker and not the speakerphone speaker.

sirknightj commented 1 year ago

I can confirm that audio is being sent and received on both master and viewer side.

https://github.com/awslabs/amazon-kinesis-video-streams-webrtc-sdk-ios/assets/14988194/aedd0f28-3e22-4f3b-953a-8217ce51d4fe

In the video above (may need to turn up your volume), master is the first iPhone (right), viewer is the second iPhone (left).