UnbluScreenSharingHandler

class UnbluScreenSharingHandler

Bridge broadcast-upload handler that serves both Unblu screen-sharing transports — mobile co-browsing (UnbluCoBrowsingSampleHandler) and LiveKit (LKSampleHandler) — through a single ReplayKit broadcast extension.

The SDK writes the active transport into the shared App Group (selectTransport). This handler reads it when the broadcast starts and forwards every ReplayKit callback to the matching concrete handler.

Use it as the principal class (NSExtensionPrincipalClass) of a ReplayKit broadcast-upload extension:

import UnbluCoreSDK
class SampleHandler: UnbluScreenSharingHandler {}

The concrete handlers live in optional modules the core SDK must not depend on, so they are resolved by class name at runtime: whichever module the extension links is used; if only one is linked, it is used regardless of the selection.

Required configuration outside of code:

  • Extension’s Info.plist: RTCAppGroupIdentifier = the shared App Group.
  • App’s Info.plist: RTCScreenSharingExtension = the extension’s bundle id. Without it, LiveKit screen sharing is not offered and co-browsing stays in screenshot mode (the broadcast never auto-starts).
  • App Groups capability on both targets, with the same group id.
  • Info.plist key of the extension holding the App Group identifier.

    It is the same key LKSampleHandler and UnbluCoBrowsingSampleHandler read.

    Declaration

    Swift

    static let appGroupInfoPlistKey: String
  • App Group used when the Info.plist does not define appGroupInfoPlistKey.

    Declaration

    Swift

    static let defaultAppGroupIdentifier: String
  • Info.plist key of the host app naming the broadcast extension’s bundle identifier.

    It is the same key LiveKit reads to preselect the extension in the system broadcast picker. The SDK requires it for screen sharing: LiveKit screen sharing is only offered and co-browsing only auto-starts the broadcast when the app declares it.

    Declaration

    Swift

    static let screenSharingExtensionInfoPlistKey: String
  • Shared-defaults key holding the selected transport.

    Declaration

    Swift

    static let selectedTransportKey: String
  • Transport value for LiveKit screen sharing (LKSampleHandler).

    Declaration

    Swift

    static let transportLiveKit: String
  • Transport value for mobile co-browsing screen sharing (UnbluCoBrowsingSampleHandler).

    Declaration

    Swift

    static let transportCoBrowsing: String
  • App Group shared between the host app and the extension.

    Read from the current bundle’s Info.plist (app or extension, same key in both); falls back to defaultAppGroupIdentifier when the key is absent.

    Declaration

    Swift

    static var appGroupIdentifier: String { get }
  • Records which transport the next broadcast should use. Called by the SDK in the host app before it initiates a broadcast.

    Declaration

    Swift

    static func selectTransport(_ transport: String)

    Parameters

    transport