Streams : Select media devices

Here is a description of the different steps to select a media device (mic, camera) to create a stream

Create and register a UserAgent

Check our tutorial on registration if needed to create the userAgent and register.

On iOS SDK, you can create a stream with front or back camera or with an external camera.

Create the stream using front or back camera

Use ApiRTCStream.createCameraStream(position:) to create a stream. Position can be .front or .back.

        var stream: ApiRTCStream!
        do {
            stream = try ApiRTCStream.createCameraStream(position: .front)
        catch {

Create the stream using external camera

Use ApiRTCStream.createExternalCameraStream() to create a stream with an external camera connected to the device.

        var stream = ApiRTCStream.createExternalCameraStream()

Create only an audio stream

Use createAudioStream() to create an audio stream.

        var stream = ApiRTCStream.createAudioStream()