AudioVideoControllerFacade

@objc
public protocol AudioVideoControllerFacade

AudioVideoControllerFacade manages the signaling and peer connections.

  • Declaration

    Swift

    var configuration: MeetingSessionConfiguration { get }
  • Declaration

    Swift

    var logger: Logger { get }
  • Start AudioVideo Controller

    Throws

    PermissionError.audioPermissionError if RecordPermission is not given

    Throws

    MediaError.audioFailedToStart if audio client failed to start

    Throws

    MediaError.illegalState if audio client is already started before calling start()

    Declaration

    Swift

    func start(audioVideoConfiguration: AudioVideoConfiguration) throws

    Parameters

    audioVideoConfiguration

    The configuration used for Audio & Video

  • Start AudioVideo Controller

    Throws

    PermissionError.audioPermissionError if RecordPermission is not given

    Throws

    MediaError.audioFailedToStart if audio client failed to start

    Throws

    MediaError.illegalState if audio client is already started before calling start()

    Declaration

    Swift

    func start(callKitEnabled: Bool) throws

    Parameters

    callKitEnabled

    A Bool value to indicate whether the VoIP call to start has CallKit integration. This parameter is used to determine how audio session interruptions should be handled, in scenarios such as receving another phone call during the VoIP call.

  • Start AudioVideo Controller

    Throws

    PermissionError.audioPermissionError if RecordPermission is not given

    Throws

    MediaError.audioFailedToStart if audio client failed to start

    Throws

    MediaError.illegalState if audio client is already started before calling start()

    Declaration

    Swift

    func start() throws
  • Stop AudioVideo Controller. This will exit the meeting

    Declaration

    Swift

    func stop()
  • Start local video and begin transmitting frames from an internally held DefaultCameraCaptureSource. stopLocalVideo will stop the internal capture source if being used.

    Calling this after passing in a custom VideoSource will replace it with the internal capture source.

    This function will only have effect if start has already been called

    Throws

    PermissionError.videoPermissionError if video permission of AVCaptureDevice is not granted

    Declaration

    Swift

    func startLocalVideo() throws
  • Start local video with configurations and begin transmitting frames from an internally held DefaultCameraCaptureSource. stopLocalVideo will stop the internal capture source if being used.

    Calling this after passing in a custom VideoSource will replace it with the internal capture source.

    This function will only have effect if start has already been called If maxBitRateKbps is not set, it will be self adjusted depending on number of users and videos in the meeting

    Throws

    PermissionError.videoPermissionError if video permission of AVCaptureDevice is not granted

    Declaration

    Swift

    func startLocalVideo(config: LocalVideoConfiguration) throws

    Parameters

    config

    configurations of emitted video stream, e.g. simulcast, maxBitRateKbps

  • Start local video with a provided custom VideoSource which can be used to provide custom VideoFrames to be transmitted to remote clients. This will call VideoSource.addVideoSink on the provided source.

    Calling this function repeatedly will replace the previous VideoSource as the one being transmitted. It will also stop and replace the internal capture source if startLocalVideo was previously called with no arguments.

    This function will only have effect if start has already been called

    Declaration

    Swift

    func startLocalVideo(source: VideoSource)

    Parameters

    source

    The source of video frames to be sent to other clients

  • Start local video with configurations and a provided custom VideoSource which can be used to provide custom VideoFrames to be transmitted to remote clients. This will call VideoSource.addVideoSink on the provided source.

    Calling this function repeatedly will replace the previous VideoSource as the one being transmitted. It will also stop and replace the internal capture source if startLocalVideo was previously called with no arguments.

    This function will only have effect if start has already been called If maxBitRateKbps is not set, it will be self adjusted depending on number of users and videos in the meeting

    Declaration

    Swift

    func startLocalVideo(source: VideoSource, config: LocalVideoConfiguration)

    Parameters

    source

    The source of video frames to be sent to other clients

    config

    Configurations of emitted video stream, e.g. simulcast, maxBitRateKbps

  • Stops sending video for local attendee. This will additionally stop the internal capture source if being used. If using a custom video source, this will call VideoSource.removeVideoSink on the previously provided source.

    Declaration

    Swift

    func stopLocalVideo()
  • Enable remote video to start receiving streams

    Declaration

    Swift

    func startRemoteVideo()
  • Disable remote video to stop receiving streams

    Declaration

    Swift

    func stopRemoteVideo()
  • Subscribe to audio, video, and connection events with an AudioVideoObserver.

    Declaration

    Swift

    func addAudioVideoObserver(observer: AudioVideoObserver)

    Parameters

    observer

    The observer to subscribe to events with

  • Unsubscribes from audio, video, and connection events by removing specified AudioVideoObserver.

    Declaration

    Swift

    func removeAudioVideoObserver(observer: AudioVideoObserver)

    Parameters

    observer

    The observer to unsubscribe from events with

  • Subscribe to metrics events with an MetricsObserver.

    Declaration

    Swift

    func addMetricsObserver(observer: MetricsObserver)

    Parameters

    observer

    The observer to subscribe to events with

  • Unsubscribes from metrics events by removing specified MetricsObserver.

    Declaration

    Swift

    func removeMetricsObserver(observer: MetricsObserver)

    Parameters

    observer

    The observer to unsubscribe from events with

  • Add, update, or remove subscriptions to remote video sources provided via remoteVideoSourcesDidBecomeAvailable.

    This function requires using the RemoteVideoSource provided by remoteVideoSourcesDidBecomeAvailable, otherwise it will not update properly. This is what allows to use the RemoteVideoSource objects as keys in a map.

    Including a RemoteVideoSource in addedOrUpdated which was not previously provided will result in the negotiation of media flow for that source. After negotiation has completed,videoTileDidAdd on the tile controller will be called with the TileState of the source, and applications can render the video via ‘bindVideoTile’. Reincluding a RemoteVideoSource can be done to update the provided VideoSubscriptionConfiguration, but it is not necessary to continue receiving frames.

    Including a RemoteVideoSource in removed will stop the flow video from that source, and lead to a videoTileDidRemove call on the tile controller to indicate to the application that the tile should be unbound. To restart the flow of media, the source should be re-added by including in addedOrUpdated. Note that videos no longer available in a meeting (i.e. listed in remoteVideoSourcesDidBecomeUnavailable do not need to be removed, as they will be automatically unsubscribed from.

    Note that before this function is called for the first time, the client will automatically subscribe to all video sources. However this behavior will cease upon first call (e.g. if there are 10 videos in the meeting, the controller will subscribe to all 10, however if updateVideoSourceSubscriptions is called with a single video in addedOrUpdated, the client will unsubscribe from the other 9. This automatic subscription behavior may be removed in future major version updates, builders should avoid relying on the logic and instead explicitly call updateVideoSourceSubscriptions with the sources they want to receive.

    Declaration

    Swift

    func updateVideoSourceSubscriptions(addedOrUpdated: Dictionary<RemoteVideoSource, VideoSubscriptionConfiguration>, removed: Array<RemoteVideoSource>)

    Parameters

    addedOrUpdated

    Dictionary of remote video sources to configurations to add or update

    removed

    Array of remote video sources to remove

  • Allows an attendee in a Replica meeting to immediately transition to a Primary meeting attendee without need for reconnection.

    PrimaryMeetingPromotionObserver.didPromoteToPrimaryMeeting will be called exactly once on observer for each call. If the promotion is successful, PrimaryMeetingPromotionObserver.didDemoteFromPrimaryMeeting will be called exactly once if/when the attendee is demoted. See the observer documentation for possible status codes.

    Application code may also receive a callback on AudioVideoObserver.videoSessionDidStartWithStatus without MeetingSessionStatusCode.VideoAtCapacityViewOnly to indicate they can begin to share video.

    chime::DeleteAttendee on the Primary meeting attendee will result in PrimaryMeetingPromotionObserver.didDemoteFromPrimaryMeeting to indicate the attendee is no longer able to share.

    Any disconnection will trigger an automatic demotion to avoid unexpected or unwanted promotion state on reconnection. This will also call PrimaryMeetingPromotionObserver.didDemoteFromPrimaryMeeting; if the attendee still needs to be an interactive participant in the Primary meeting, promoteToPrimaryMeeting should be called again with the same credentials.

    Note that given the asynchronous nature of this function, this should not be called a second time before PrimaryMeetingPromotionObserver.didPromoteToPrimaryMeeting is called for the first time. Doing so may result in unexpected behavior.

    Declaration

    Swift

    func promoteToPrimaryMeeting(credentials: MeetingSessionCredentials, observer: PrimaryMeetingPromotionObserver)

    Parameters

    credentials

    The credentials for the primary meeting. This needs to be obtained out of band.

    observer

    Will be called with a session status for the request and possible demotion. See possible options above.

  • Remove the promoted attendee from the Primary meeting. This client will stop sharing audio, video, and data messages. This will revert the end-user to precisely the state they were before a call to promoteToPrimaryMeeting

    This will have no effect if there was no previous successful call to promoteToPrimaryMeeting. This may result in PrimaryMeetingPromotionObserver.didPromoteToPrimaryMeeting but there is no need to wait for that callback to revert UX, etc.

    Declaration

    Swift

    func demoteFromPrimaryMeeting()