twilio / video-quickstart-ios

Twilio Video Quickstart for iOS
https://www.twilio.com/docs/api/video
MIT License
460 stars 178 forks source link

Cannot create a TVILocalAudioTrack because the supplied AudioDevice does not support audio capturing. #664

Closed cyopaulo closed 11 months ago

cyopaulo commented 11 months ago

Description

I'm trying to create a audio device using the audio device provided by twilio I receive this error message. I request the microphone and camera permissions. 'Cannot create a TVILocalAudioTrack because the supplied AudioDevice does not support audio capturing.'

Steps to Reproduce

Change the TwilioVideoSDK.audioDevice = audioDevice to this one that I create and it will crash

Code

class LocalRecordingAudioDevice: NSObject {
    private var engineAudioDeviceContext: AudioDeviceContext?
}

extension LocalRecordingAudioDevice : AudioDevice {
    func renderFormat() -> AudioFormat? {
        return nil
    }

    func initializeRenderer() -> Bool {
        return false
    }

    func startRendering(context: AudioDeviceContext) -> Bool {
        return false
    }

    func stopRendering() -> Bool {
        return false
    }

    func captureFormat() -> AudioFormat? {
        return nil
    }

    func initializeCapturer() -> Bool {
        return true
    }

    func startCapturing(context: AudioDeviceContext) -> Bool {
        engineAudioDeviceContext = context

        return true
    }

    func stopCapturing() -> Bool {
        engineAudioDeviceContext = nil
        return true
    }
}

let audioDevice = LocalRecordingAudioDevice()

TwilioVideoSDK.audioDevice = audioDevice

Expected Behavior

At least the project will run without crashing it

Actual Behavior

Have a crash on start

Video iOS SDK

5.7.0 SPM

Xcode

15.0.1

iOS Version

17.0.1

iOS Device

iPhone 13 Pro