ApiRTC iOS SDK Documentation

Class Stream

open class Stream: Observable<StreamEvent>  
Stream Stream AVCaptureVideoDataOutputSampleBufferDelegate AVCaptureVideoDataOutputSampleBufferDelegate Stream->AVCaptureVideoDataOutputSampleBufferDelegate Observable<StreamEvent> Observable<StreamEvent> Stream->Observable<StreamEvent> Descriptable Descriptable Stream->Descriptable

Conforms To

AVCaptureVideoDataOutputSampleBufferDelegate
Observable<StreamEvent>

Properties

id

open private(set) var id: String! 

type

open private(set) var type: StreamType = .unknown

direction

open var direction: StreamDirection  

Stream pub/sub direction

capture​Session

open private(set) var captureSession: AVCaptureSession?  

Capture session if applicable

device

open private(set) var device: AVCaptureDevice? 

Capture device if applicable

format

open private(set) var format: AVCaptureDevice.Format? 

Capture format if applicable

media​Stream

open private(set) var mediaStream: MediaStream?  

MediaStream if applicable

Methods

create​Camera​Stream(position:​format:​)

open class func createCameraStream(position: AVCaptureDevice.Position, format: AVCaptureDevice.Format? = nil) throws -> Stream  

Creates a camera stream with given settings

create​Audio​Stream()

open class func createAudioStream() -> Stream  

Creates audio stream

create​External​Camera​Stream()

open class func createExternalCameraStream() -> Stream  

mute​Audio()

open func muteAudio()  

Mutes audio. If this stream is published to another contact, the stream will also be muted on the contact's side. If this stream is subscribed from another contact, muting the stream will have no impact on the contact's side

unmute​Audio()

open func unmuteAudio()  

Unmutes audio. If this stream is published to another contact, the stream will also be unmuted on the contact's side. If this stream is subscribed from another contact, unmuting the stream will have no impact on the contact's side, moreover, it will not unmute the stream if it has been muted by the contact

mute​Video()

open func muteVideo()  

Mutes video. If this stream is published to another contact, the stream will also be muted on the contact's side. If this stream is subscribed from another contact, muting the stream will have no impact on the contact's side

unmute​Video()

open func unmuteVideo()  

Unmutes video. If this stream is published to another contact, the stream will also be unmuted on the contact's side. If this stream is subscribed from another contact, muting the stream will have no impact on the contact's side, moreover, it will not unmute the stream if it has been muted by the contact

is​Audio​Muted()

open func isAudioMuted() -> Bool  

Returns whether the audio track in muted

is​Video​Muted()

open func isVideoMuted() -> Bool  

Returns whether the video track in muted

has​Audio()

open func hasAudio() -> Bool  

Checks if stream has at least one audio track

has​Video()

open func hasVideo() -> Bool  

Checks if stream has at least one video track

supported​Formats(_:​)

open class func supportedFormats(_ device: AVCaptureDevice) -> [AVCaptureDevice.Format]  

Returns supported formats by WebRTC for the given device

add​Renderer(_:​)

open func addRenderer(_ renderer: RTCVideoRenderer)  

Adds renderer to the current VideoTrack if applicable

get​Owner()

open func getOwner() -> Contact  

Returns stream's owner

get​Conversations()

open func getConversations() -> [Conversation]?  

Returns conversations the stream is published in

take​Snapshot(completion:​)

open func takeSnapshot(completion: @escaping (_ error: Error?, _ image: UIImage?) -> Void)  

Takes snapshot from video stream, limited for local stream

on​Event(_:​_:​)

open override func onEvent(_ observer: AnyObject, _ callback: @escaping ((StreamEvent) -> Void))  

capture​Output(_:​did​Output:​from:​)

public func captureOutput(_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection)