IVSBroadcastSessionDelegate

Objective-C

@protocol IVSBroadcastSessionDelegate <NSObject>

Swift

protocol Delegate : NSObjectProtocol

Provide a delegate to receive status updates and errors from the SDK. Updates may be run on arbitrary threads and not the main thread.

  • Indicates that the broadcast state changed.

    Declaration

    Objective-C

    - (void)broadcastSession:(nonnull IVSBroadcastSession *)session
              didChangeState:(IVSBroadcastSessionState)state;

    Swift

    func broadcastSession(_ session: IVSBroadcastSession, didChange state: IVSBroadcastSession.State)

    Parameters

    session

    The IVSBroadcastSession that just changed state

    state

    current broadcast state

  • Indicates that an error occurred. Errors may or may not be fatal and will be marked as such with the IVSBroadcastErrorIsFatalKey in the userInfo property of the error.

    Note

    In the case of a fatal error the broadcast session moves into disconnected state.

    Declaration

    Objective-C

    - (void)broadcastSession:(nonnull IVSBroadcastSession *)session
                didEmitError:(nonnull NSError *)error;

    Swift

    func broadcastSession(_ session: IVSBroadcastSession, didEmitError error: Error)

    Parameters

    session

    The IVSBroadcastSession that just emitted the error.

    error

    error emitted by the SDK.

  • Indicates that a device has become available.

    Note

    In the case of audio devices, it is possible the system has automatically rerouted audio to this device. You can check listAttachedDevices to see if the attached audio devices have changed.

    Declaration

    Objective-C

    - (void)broadcastSession:(nonnull IVSBroadcastSession *)session
                didAddDevice:(nonnull IVSDeviceDescriptor *)descriptor;

    Swift

    optional func broadcastSession(_ session: IVSBroadcastSession, didAddDevice descriptor: IVSDeviceDescriptor)

    Parameters

    session

    The IVSBroadcastSession that added the device

    descriptor

    the device’s descriptor

  • Indicates that a device has become unavailable.

    Note

    In the case of audio devices, it is possible the system has automatically rerouted audio from this device to another device. You can check listAttachedDevices to see if the attached audio devices have changed.

    It is possible that this will not be called if a device that is not in use gets disconnected. For example, if you have attached the built-in microphone to the broadcast session, but also have a bluetooth microphone paired with the device, this may not be called if the bluetooth device disconnects. Anything impacting an attached device will result in this being called however.

    Declaration

    Objective-C

    - (void)broadcastSession:(nonnull IVSBroadcastSession *)session
             didRemoveDevice:(nonnull IVSDeviceDescriptor *)descriptor;

    Swift

    optional func broadcastSession(_ session: IVSBroadcastSession, didRemoveDevice descriptor: IVSDeviceDescriptor)

    Parameters

    session

    The IVSBroadcastSession that removed the device

    descriptor

    the device’s descriptor. This may not contain specific hardware information other than IDs.

  • Periodically called with audio peak and rms in dBFS. Range is -100 (silent) to 0.

    Declaration

    Objective-C

    - (void)broadcastSession:(nonnull IVSBroadcastSession *)session
        audioStatsUpdatedWithPeak:(double)peak
                              rms:(double)rms;

    Swift

    optional func broadcastSession(_ session: IVSBroadcastSession, audioStatsUpdatedWithPeak peak: Double, rms: Double)

    Parameters

    session

    The IVSBroadcastSession that associated with the audio stats.

    peak

    Audio Peak over the time period

    rms

    Audio RMS over the time period