StreamLayer

@objc
public class StreamLayer : NSObject

Namespace for StreamLayer SDK

  • Returns active overlay if its presented

    Declaration

    Swift

    @objc
    public static var activeOverlay: SLROverlay? { get }
  • Returns top active overlay controller. There could only be 1 copy per app

    Declaration

    Swift

    @objc
    private(set) public weak static var activeController: SLRWidgetsViewController? { get }
  • Initializes SDK

    Declaration

    Swift

    @objc
    public class func initSDK(with key: String,
                              isDebug: Bool = false,
                              delegate: StreamLayerDelegate? = nil,
                              loggerDelegate: SLROverlayLoggerDelegate? = nil)

    Parameters

    key

    String SDK key can be acquired in the admin panel, it authenticates your application on our server

    isDebug

    Bool Default is False. If true, you can catch logs with SLROverlayLoggerDelegate methods

    loggerDelegate

    SLROverlayLoggerDelegate optional delegate that can catch sendLogdata method

  • When called initiates processing of universal & deep links

    Declaration

    Swift

    @objc
    public class func initiateLinksHandler(launchOptions: [UIApplication.LaunchOptionsKey : Any]?)

    Parameters

    launchOptions

    UIApplication launch options

  • Convenience method to initialize StreamLayer SDK

    Declaration

    Swift

    @objc
    public class func createOverlay(_ referenceView: UIView? = nil,
                                    overlayDelegate: SLROverlayDelegate) -> SLRWidgetsViewController

    Parameters

    referenceView

    pass on UIViewLayoutGuide or UIView, acts as a guide for overlay positioning

    overlayDelegate

    overlayDelegate

    Return Value

    OverlayViewController instance that must be attached to view hierarchy

  • Convenience method to remove StreamLayer Controller Could be used when you’ve presented StreamLayer SDK controller in a modal view and need to remove it

    Declaration

    Swift

    @objc
    public static func removeOverlay()
  • SDK supports event by event configuration. After StreamLayer SDK has been initialized to configure make sure to call this method at least once to fetch active configuration.

    Every time current event is changing this method should be called with a new event id to fetch relevant configuration

    Usage:

    Show that stream-related menu items only

    StreamLayer.changeStreamEvent("asdf")
    

    Show that stream-related menu items plus add custom as second item

    private var customMenuItem: SLRCustomMenuItem = {
      let menuItem = SLRCustomMenuItem()
      menuItem.iconImage = UIImage(named: "customMenuIcon")
      menuItem.viewController = MyCustomOverlayViewController()
      return menuItem
    }()
    StreamLayer.changeStreamEvent("asdf", andAddMenuItem: customMenuItem)
    

    Declaration

    Swift

    public class func changeStreamEvent<T>(for eventId: T, andAddMenuItem customMenuItem: SLRCustomMenuItem? = nil) where T : LosslessStringConvertible

    Parameters

    eventId

    string-convertible, use the same id as you normally use when accessing a particular event in the app

    customMenuItem

    custom menu item that you can show for stream

  • Declaration

    Swift

    @objc
    public class func uploadDeviceAPNsToken(deviceAPNsToken: String)

    Parameters

    deviceAPNsToken

    device token received from APNs allowing to StreamLayer service to send push notifications

  • Undocumented

    Declaration

    Swift

    public class func removeDeviceAPNsToken()
  • Declaration

    Swift

    @objc
    public class func processDeepLink(_ app: UIApplication, _ url: URL, _ options: [UIApplication.OpenURLOptionsKey : Any]) -> Bool

    Parameters

    app

    Current Application

    url

    deeplink URL to process

    options

    URL open options

    Return Value

    false if link cant be processed

  • Universal link handler

    Declaration

    Swift

    @objc
    public class func processUniversalLink(continue userActivity: NSUserActivity) -> Bool

    Parameters

    userActivity

    NSUserActivity

    Return Value

    false if link cant be processed

  • Convenience method to show/hide StreamLayer launch button Could be used when you want to show/hide lauch button

    Declaration

    Swift

    @objc
    public static func hideLaunchButton(_ flag: Bool)
  • Undocumented

    Declaration

    Swift

    @objc
    public static func isUserAuthorized() -> Bool
    • token: host app authorization token for authenticating in the Streamlayer SDK without providing user data
    • schema: authorization schema to validate host app
    • completion: Response handler.

    Declaration

    Swift

    public static func setAuthorizationBypass(token: String,
                                              schema: String,
                                              completion: ((Swift.Result<String, Error>) -> Void)? = nil)
  • Logout from SDK When the host app makes logout it should call logout from SDK to clean the chashed user data.

    Declaration

    Swift

    @objc
    public static func logout()
  • Undocumented

    Declaration

    Swift

    @objc
    public static func isAuthorizedViaBypass() -> Bool
  • Host app must set value to true to prevent show SDK Auth flow

    • enable: is enable SDK auth flow

    Declaration

    Swift

    public static func setExternalAuth(enable: Bool)
  • Undocumented

    Declaration

    Swift

    @objc
    public static func isExternalAuth() -> Bool
  • Attempt to handle push notification by StreamLayer. I

    Declaration

    Swift

    @discardableResult
    @objc
    public class func handlePushNotification(_ center: UNUserNotificationCenter?,
                                             userInfo: [AnyHashable: Any],
                                             background: Bool) -> Bool

    Parameters

    center

    indicates that user opened the push notification

    userInfo

    associated push notification payload

    background

    is push notificatio opened by a user tap it from notification center

    Return Value

    true if notification was handled, false otherwise

  • Prepare audiosession for background audio palyback. Call on video stream start.

    Throws

    WebRTC audio session errors

    Declaration

    Swift

    @objc
    public static func prepareSessionForGeneralAudio(reactivate: Bool) throws

    Parameters

    reactivate

    optionally reactivate audio session.

  • Deactivate audio session locking RTCAudioSession shared instance. Safer way to disable audio session if you need it.

    Throws

    WebRTC audio session errors

    Declaration

    Swift

    @objc
    public static func closeAudioSession() throws