UnbluMobileCoBrowsingModuleApi

protocol UnbluMobileCoBrowsingModuleApi : UnbluModule

This is the api for the mobile co-browsing module. This is only usable if the corresponding module got registered in the used configuration.

  • The delegate for mobile co-browsing related events

    Declaration

    Swift

    var delegate: (any UnbluMobileCoBrowsingModuleDelegate)? { get set }
  • The maximum windowLevel that Unblu will capture during mobile co-browsing. If you have other UIWindows in your application, their level must be lower or equal than maxWindowCapturingLevel to be captured. There are also some prerequisites for capturing defined in the discussion below.

    In order for a UIWindow to be captured by Unblu, it’s windowLevel property must be satisfied by the following criteria:

    • The UIWindow can have a windowLevel of UIWindow.Level.statusBar
    • The UIWindow can have a windowLevel of UIWindow.Level.alert
    • If 1 of the previous 2 points are not satisfied, the UIWindow must have a windowLevel of at most maxWindowCapturingLevel.

    Declaration

    Swift

    var maxWindowCapturingLevel: UIWindow.Level { get set }
  • The UIStatusBarStyle Unblu will use on UIViewController’s during a mobile co-browsing session. This can be configured at runtime, and when the mobile co-browsing module is created using UnbluMobileCoBrowsingModuleConfiguration. The default value is .default.

    Declaration

    Swift

    var preferredStatusBarStyle: UIStatusBarStyle { get set }
  • Checks if mobile co-browsing is active

    Declaration

    Swift

    func isMobileCoBrowsingActive(success: @escaping (Bool) -> Void, failure: ((UnbluIsMobileCoBrowsingActiveError) -> Void)?)

    Parameters

    success

    Called with true if mobile co-browsing is active

    failure

    Called if the api is not initialized or the used collaboration server is not of version 5.x newer than 5.17 or newer than 6.3

  • Stops mobile co-browsing

    Declaration

    Swift

    func stopMobileCoBrowsing(success: @escaping () -> Void, failure: ((UnbluStopMobileCoBrowsingError) -> Void)?)
  • Adds the view with the given tag to the set of private views.

    Private views are only visible on the mobile device and won’t be transmitted when co-browsing. The views will be covered before they are transmitted and therefore won’t be visible on the agent side.

    Note:

    Do not add to many tags simultaneously, because each private view will need extra performance while capturing the UI. The best practice is to dynamically make views private, when they are displayed in the app UI and remove them from the private view list when they are not visible anymore.

    Multiple calls with the same tag do not have any effect.

    Declaration

    Swift

    func addPrivateView(withTag tag: Int)
  • Removes the view with the given tag from the set of private views.

    Multiple calls with the same tag do not have any effect.

    See: #addPrivateView

    Declaration

    Swift

    func removePrivateView(withTag tag: Int)
  • Adds a private area of the screen that will be obscured during a mobile co-browsing session. If a private area already exists with this id, the current existing one will be updated and returned.

    Declaration

    Swift

    func addPrivateArea(withId id: String, x: CGFloat?, y: CGFloat?, width: CGFloat?, height: CGFloat?) -> UnbluMobileCoBrowsingPrivateArea

    Parameters

    x

    The new absolute x position of the private area on the screen (optional)

    y

    The new absolute y position of the private area on the screen (optional)

    width

    The new width of the private area on the screen (optional)

    height

    The new width of the private area on the screen (optional)

    Return Value

    An instance of UnbluMobileCoBrowsingPrivateArea.

  • Removes a private area with a given id that represents an area of the screen currently obscured during a co browsing session.

    Declaration

    Swift

    func removePrivateArea(withId id: String)
  • The name of the system icon for the icon image that will be displayed on a control button during a co-browsing session will be set using UIImage(systemName: “icon_name”). Here, “icon_name” will be replaced with the actual system icon name. The system icon name refers to choosing an icon from the SF Symbols library recommended by Apple. If this name is not set, a system icon with the default name “square.on.square” will be displayed instead.

    Declaration

    Swift

    var systemIconName: String? { get set }
  • When true, the “Return to conversation” action is hidden from the co-browsing indicator confirmation dialog shown when the indicator button is tapped. Useful for integrations that don’t include the Unblu conversation UI in the host app, where the action is irrelevant.

    The default value is false.

    Declaration

    Swift

    var hideReturnToConversationAction: Bool { get set }
  • Gets the current co-browsing capture mode

    Declaration

    Swift

    var captureMode: CoBrowsingCaptureMode { get }

    Return Value

    The current capture mode (screenshot or replayKit)

  • Sets the co-browsing capture mode

    Note: When switching to ReplayKit mode, the user will be prompted to start screen recording. The app must have a broadcast extension configured to use ReplayKit mode.

    Declaration

    Swift

    func setCaptureMode(_ mode: CoBrowsingCaptureMode, completion: @escaping (Bool, (any Error)?) -> Void)

    Parameters

    mode

    The capture mode to use (screenshot or replayKit)

    completion

    Called when the mode change is complete, with success status and optional error

  • Whether the OS reports screen recording as currently available on this device (backed by RPScreenRecorder.shared().isAvailable).

    This reflects device/OS capability only — it can be false when the system cannot record right now (e.g. AirPlay/mirroring active, recording restricted by an MDM profile or Guided Access). It is unrelated to whether the broadcast-upload extension has been added and configured in the host app.

    Declaration

    Swift

    var isReplayKitAvailable: Bool { get }

    Return Value

    true if the OS can currently start a ReplayKit recording

  • Provides frames from ReplayKit to the co-browsing module This method is used by the broadcast extension to feed captured frames

    Note: This method should only be called from the ReplayKit broadcast extension

    Declaration

    Swift

    func processReplayKitFrame(_ frameData: Data)

    Parameters

    frameData

    The JPEG data of the captured frame

  • Enables or disables showing the agent’s marker in a Picture-in-Picture window while the user has left the app during device-wide (ReplayKit) screen sharing.

    When enabled, a small PiP window is armed when device-wide co-browsing starts (while the app is in the foreground, as required by iOS) and appears automatically when the user switches to another app. When the agent marks something, the marked region is shown in that PiP window for a few seconds. In-app co-browsing is unaffected — the marker keeps using the normal on-screen overlay.

    Requires iOS 15+ and the “Audio, AirPlay, and Picture in Picture” background mode in the host app. Disabled by default.

    Declaration

    Swift

    func setAgentMarkerVisibleOutsideApp(_ enabled: Bool)

    Parameters

    enabled

    true to show the agent’s marker outside the app via PiP, false to disable it.