API Reference

Complete reference for every public class, protocol, struct, enum, and method exposed by the StreamLayer SDK.


Table of Contents


Core — StreamLayer (iOS)

StreamLayer

final public class StreamLayer: NSObject

Main entry point for the StreamLayer SDK. All SDK functionality is accessed through static methods on this class.

MemberSignatureDescription
sharedpublic private(set) static var shared: StreamLayer!Singleton instance created by initSDK.
configstatic public var config: StreamLayerConfigGlobal SDK configuration. Set before initSDK.
themestatic public var theme: SLRThemeSDK theme / styling entry point.
activeControllerstatic private(set) public weak var activeController: SLRWidgetsViewController?Currently active overlay controller.
inviteLinkHandlerpublic static var inviteLinkHandler: StreamLayerInviteLinkHandler?Custom invite link handler. Falls back to SDK's internal generator when nil.
bugseeDelegatepublic weak var bugseeDelegate: SLRBugseeDelegate?Bugsee crash-debugging delegate.

Initialization

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

Initialize the SDK. Must be called once before any other SDK API.

ParameterTypeDescription
keyStringSDK key from the admin panel.
isDebugBoolEnables verbose logging. Default false.
delegateStreamLayerDelegate?Host-app delegate for invites and auth.
loggerDelegateSLROverlayLoggerDelegate?Optional Crashlytics / log receiver.

Example:

StreamLayer.initSDK(with: "YOUR_SDK_KEY", isDebug: true, delegate: self)

@objc
public class func isInitialized() -> Bool

Returns true if the SDK has been initialized.


public class func sdkVersion() -> String

Returns the SDK version string in major.minor.patch(build) format.


public static func configureAPIURL(apiURLString: String?)

Override the default API host URL.


Session Management

@discardableResult
public class func createSession(
    for eventId: String,
    timecodeProvider: SLRTimecodeProvider? = nil,
    andAddMenuItems customMenuItems: [SLRCustomMenuProtocol]? = nil
) -> SLREventSession

Create or update the active event session. Must be called each time the current event changes.

ParameterTypeDescription
eventIdStringHost-app event ID.
timecodeProviderSLRTimecodeProvider?Provides current playback timestamp.
customMenuItems[SLRCustomMenuProtocol]?Custom menu items to inject into the overlay.

Returns: SLREventSession — the active session.

Example:

let session = StreamLayer.createSession(for: "event-123")

// With custom menu item
let menuItem = SLRCustomMenuItem(viewController: MyCustomVC())
menuItem.iconImage = UIImage(named: "custom_icon")
StreamLayer.createSession(for: "event-123", andAddMenuItems: [menuItem])

public func requestDemoStreams(
    showAllStreams: Bool,
    completion: @escaping (([SLRStreamModel]) -> Void)
)

Fetch demo streams for development/testing. Called on the shared instance.


Authorization

public static func setAuthorizationBypass(
    token: String,
    schema: String
) async throws

Authenticate via host-app bypass token (SSO).

public static func useAnonymousAuth() async throws

Set anonymous authentication for the current user.

public static func isUserAuthorized() -> Bool

Returns true if a user is currently authorized.

public static func isUserAnonymous() -> Bool

Returns true if the current user is anonymously authenticated.

public static func logout()

Logout the current user and clear cached data.


Authentication

StreamLayer.Auth

public struct Auth

Namespace for authentication-related APIs, accessed as StreamLayer.Auth.

MethodSignatureDescription
requestOTPstatic func requestOTP(phoneNumber: String) async throwsSend OTP to the given phone number.
authenticatestatic func authenticate(phoneNumber: String, code: String) async throws -> SLRAuthDataAuthenticate with phone + OTP code.
setUserNamestatic func setUserName(_ name: String) async throwsUpdate the user's display name.
setPublicUserNamestatic func setPublicUserName(_ name: String) async throwsUpdate the user's public/unique name.
uploadAvatarstatic func uploadAvatar(_ image: UIImage) async throws -> StringUpload a new avatar image. Returns the URL.
deleteAvatarstatic func deleteAvatar()Delete the current user's avatar.
authenticatedUserstatic func authenticatedUser() -> SLRAuthUser?Snapshot of the currently authenticated user.

SLRRequireAuthOptions

public struct SLRRequireAuthOptions: OptionSet
OptionDescription
.nameRequire display name input.
.publicNameRequire public/unique name input.
.allBoth name and public name.
.defaultName only.

Example:

// Phone OTP flow
try await StreamLayer.Auth.requestOTP(phoneNumber: "+1234567890")
let authData = try await StreamLayer.Auth.authenticate(phoneNumber: "+1234567890", code: "1234")
print("Logged in as: \(authData.user.username)")

Configuration

StreamLayerConfig (Protocol)

public protocol StreamLayerConfig: AnyObject

Host-app configurable SDK settings. Assign to StreamLayer.config before initSDK.

PropertyTypeDefaultDescription
isAlwaysOpenedBoolfalseKeep menu always open in portrait.
phoneContactsSyncEnabledBooltrueAllow contacts access.
whoIsWatchingEnabledBooltrueShow "Who's Watching" button.
isUserProfileOverlayHiddenBooltrueHide profile in menu.
appStyleSLRStyle.blueSDK color theme.
notificationsModeSLRNotificationsMode.allWhich notifications are visible.
statisticsDataOptionsStatisticsDataOptionsProtocol?nilStatistics overlay data.
shouldIncludeTopGestureZoneBooltrueExtra gesture zone above overlay.
tooltipsEnabledBooltrueShow tutorial tooltips.
enableWatchPartyHistoryListBooltrueShow WP history.
enableWatchPartyDragAndDropBooltrueDraggable user cells in landscape.
managedGroupConfigManagedGroupConfigdefaultManaged group session appearance.
enableConnectionStatusLabelBoolfalseShow connection status.
invitesEnableBooltrueEnable invite features.
watchPartyLandscapeInsetUIEdgeInsets.zeroWP landscape insets.
triviaBalanceButtonVerticalCustomPaddingUIEdgeInsets.zeroTrivia button vertical padding.
triviaBalanceButtonHorizontalCustomPaddingUIEdgeInsets.zeroTrivia button horizontal padding.
forceCloseOverlayAfterWPLeavingBoolfalseClose overlay stack on WP leave.
watchPartyStatusViewContainerLandscapeUIView?nilCustom WP status container (landscape).
gamificationOptionsSLRGamificationOptionsdefaultGamification settings.
overlayModeSLROverlayMode.overlayOverlay or sidebar mode.
isSideBarForcingEnabledBoolfalseForce sidebar in landscape.
isSideBarSafeAreasEnabledBoolfalseSidebar safe-area spacing.
localizationStreamLayerLocalization.systemSDK language override.
enableDebugOverlayBoolfalseEnable debug overlay.
isExpandableOverlayEnabledBooltrueAllow overlay expansion.
shouldExpandOnScrollBoolfalseExpand on scroll vs. pan only.
wpStatusViewTopOffsetCGFloat0.0WP status view top offset (portrait).
pullDownTooltipTopOffsetCGFloat0.0Pull-down tooltip offset.
isAccessibilityFontsEnabledBoolfalseUse Apple accessibility fonts.
alwaysXToCloseBoolfalseAlways show X instead of auto-close.
isChatFeatureEnableBoolfalseEnable chat feature.
isStreamTimelineEnabledBoolfalseEnable Spoiler Prevention / Delayed ADs.

StreamLayerSilentModeConfig

public class StreamLayerSilentModeConfig: StreamLayerConfig

Pre-configured silent mode: all notifications disabled, WW button hidden, menu hidden.

StreamLayer.config = StreamLayerSilentModeConfig()

ManagedGroupConfig

public struct ManagedGroupConfig
PropertyTypeDefaultDescription
watchPartyLandscapeInsetUIEdgeInsets.zeroManaged WP landscape inset.
watchPartyInitialDraggableAreaSLRDraggableArea.leftInitial thumbnail position.
managedGroupOverlayWidthCGFloat300Overlay width in landscape.

Initializers:

public init(
    watchPartyLandscapeInset: UIEdgeInsets,
    watchPartyInitialDraggableArea: SLRDraggableArea,
    managedGroupOverlayWidth: CGFloat
)
public init()

SLRGamificationOptions

public struct SLRGamificationOptions
PropertyTypeDefaultDescription
globalLeaderBoardEnabledBoolfalseShow leaderboard tab.
invitesEnabledBooltrueShow invites in onboarding.
isOnboardingEnabledBooltrueRequire onboarding before game.
showGamificationNotificationOnboardingBooltrueShow notification onboarding.

Initializer:

public init(
    globalLeaderBoardEnabled: Bool,
    invitesEnabled: Bool,
    isOnboardingEnabled: Bool,
    showGamificationNotificationOnboarding: Bool
)

StatisticsDataOptions

public struct StatisticsDataOptions: StatisticsDataOptionsProtocol
PropertyTypeDescription
golfStatisticsStringUrlStringStatistics endpoint URL.
golfStatisticsPollingTimerIntPolling interval in seconds.

Initializer:

public init(golfStatisticsStringUrl: String, golfStatisticsPollingTimer: Int)

Overlay & UI

Creating the Overlay

public class func createOverlay(
    mainContainerViewController: UIViewController,
    overlayDelegate: SLROverlayDelegate,
    overlayDataSource: SLROverlayDataSource,
    sideBarDelegate: SLRSideBarDelegate? = nil
) -> SLRWidgetsViewController

Create and attach the SDK overlay to your view hierarchy.

ParameterTypeDescription
mainContainerViewControllerUIViewControllerRoot VC with the container view.
overlayDelegateSLROverlayDelegateHandles audio ducking, stream switching, video control.
overlayDataSourceSLROverlayDataSourceProvides overlay height.
sideBarDelegateSLRSideBarDelegate?Optional sidebar positioning delegate.

Returns: SLRWidgetsViewController — add to your view hierarchy.

Example:

let overlay = StreamLayer.createOverlay(
    mainContainerViewController: self,
    overlayDelegate: self,
    overlayDataSource: self
)
overlay.willMove(toParent: self)
addChild(overlay)
view.addSubview(overlay.view)
overlay.didMove(toParent: self)

Showing a Specific Overlay

public class func showOverlay(
    overlayType: StreamLayerOverlayType,
    mainContainerViewController: UIViewController,
    overlayDataSource: SLROverlayDataSource,
    sideBarDelegate: SLRSideBarDelegate? = nil,
    dataOptions: [String: Any]? = nil
) throws

Present a specific overlay type. Creates a modal container if createOverlay was not called first.

overlayTypeRequired dataOptions
.statistic"url": String, "interval": Int
.games"eventId": String
.webView"url": String, "iconName": String, "title": String, optional "withAuth": Bool, "eventId": String
.twitter, .chat, .publicChat, .watchParty, .debugNone

Layout & Visibility

MethodDescription
setNeedsLayout()Recalculate overlay layout. Call in viewDidLayoutSubviews().
setReferenceViewMode(_:view:scrollView:shouldMoveToParentViewController:)Position overlay relative to a reference view. Call before createOverlay.
setReferenceControlsView(_:)Set reference controls view. Call before createOverlay.
addPassThroughView(_:) throwsAllow interaction with a view beneath the overlay.
hideLaunchButton(_:)Show/hide the SDK launch button.
hideLaunchControls(_:)Show/hide the SDK launch controls.
closeCurrentOverlay()Programmatically close the current overlay.
dismissInterface()Close overlay and minified Watch Party UI.
removeOverlay()Remove the overlay controller entirely.
changePlayerStatus(isPlaying:)Inform SDK of player playback status (spoiler prevention).

SLRWidgetsViewController

public class SLRWidgetsViewController: UIViewController, Connectable

The main overlay view controller returned by createOverlay. Add it as a child view controller to your streaming view.

SLRWatchPartyStatusView

public class SLRWatchPartyStatusView: UIView, Connectable

Displays the Watch Party status indicator.

PropertyTypeDescription
positionPositionPlacement: .left, .right, .top, .bottom, .custom.

SLRWatchPartyPillButton

public class SLRWatchPartyPillButton: UIButton

Pill-shaped button for Watch Party status display.

SLRDebugInfo

public class SLRDebugInfo

Debug information container. Use with StreamLayer.debugInfo(listener:).

PropertyTypeDescription
debugDataUpdateHandler((SLRDebugInfo) -> Void)?Called on every debug data update.
eventIdString?Current event ID.
sdkVersionString?SDK version string.
orgIdString?Organization ID.
subEventStatusString?Sub-event status.
lastFeedDescriptionString?Last feed description.
streamTimeObserverDebugItems[(title: String, value: String)]Stream time debug data.
delayedQuestionDebugItems[(title: String, value: String)]Delayed question debug data.
replayADDebugItems[(title: String, value: String)]Replay AD debug data.

Watch Party

Creating Managed Group Sessions

public static func createManagedGroupSession(
    for groupId: String,
    title: String,
    completion: @escaping SLRWatchPartySessionCreationBlock
)
ParameterTypeDescription
groupIdStringID of the group to attach.
titleStringDisplay title for the session.
completionSLRWatchPartySessionCreationBlock(SLRManagedGroupSession?, Error?) -> Void

Querying & Controlling Watch Parties

// Get active watch party ID (nil if none)
public static func activeWatchParty() -> String?

// Subscribe to active watch party changes
public static func activeWatchParty(activeWP: @escaping (String?, Bool) -> Void)

// Open/close/toggle watch party
public static func openActiveWatchParty()
public static func closeActiveWatchParty()
public static func toggleMinifiedModeThumbnails(show: Bool)

// Register a custom Watch Party video plugin
public static func registerWatchPartyPlugin(_ plugin: SLRWatchParyServiceProtocol)

SLRManagedGroupSession (Protocol)

public protocol SLRManagedGroupSession
MemberTypeDescription
currentUserIdStringInternal ID of the current user.
titleStringSession title.
topicIdStringTopic/group ID.
participants[SLRManagedGroup.Participant]Current participants.
messages((SLRManagedGroup.Message) -> Void)?Message stream callback.
events((SLRManagedGroup.Event) -> Void)?Event stream callback.
onUnsubscribed(() -> Void)?Forced unsubscription callback.
onCallEnded(() -> Void)?Call ended callback.
onSessionHeartbeat(Int) -> VoidHeartbeat with online participant count.
sendMessage(_:completion:)MethodSend a message to the session.
openWatchParty()MethodOpen the Watch Party overlay.
openChat()MethodOpen the Chat overlay.
release(completion:)MethodCancel and close the session.

SLRManagedGroup

public struct SLRManagedGroup

Nested Types

SLRManagedGroup.Message

PropertyTypeDescription
userIdStringSender user ID.
contentStringMessage content.
dateDateTimestamp.

SLRManagedGroup.User

PropertyTypeDescription
idStringTinode user ID.
bypassIdStringBypass/external user ID.

SLRManagedGroup.Participant

PropertyTypeDescription
userUserUser data.
statusParticipantStatusCurrent status.
descriptionStringComputed debug description.

SLRManagedGroup.ParticipantStatus

CaseRaw ValueDescription
.pending"PENDING"Invited, not yet joined.
.subscribed"SUBSCRIBED"Subscribed to the session.
.onCall"ON_CALL"Active in the voice/video call.

SLRManagedGroup.Event

CaseDescription
.participantsLoaded(participants:)Initial participant list loaded.
.participantUpdated(participant:)A participant was added or changed.
.participantRemoved(participant:)A participant was removed.
.sessionReleasedSession was released.

SLRManagedGroupSessionProvider

public class SLRManagedGroupSessionProvider
MemberTypeDescription
sessionSLRManagedGroupSession?Currently active session.

SLRManagedGroupSessionProvider.SessionError

public enum SessionError: Error
CaseDescription
.emptyGroupIdGroup ID was empty.
.failedToSubscribe(error:)Subscription failed with underlying error.

Type Aliases

public typealias SLRWatchPartyMessageCompletion = (Error?) -> Void
public typealias SLRWatchPartyActionCompletion = () -> Void
public typealias SLRWatchPartySessionCreationBlock = (SLRManagedGroupSession?, Error?) -> Void

Paused Ads

// Display a paused ad (iPad only)
public class func showPausedAd(_ adType: SLRPausedAdType)

// Prefetch ad content for smooth display
public class func prefetchPausedAd(
    _ adType: SLRPausedAdType,
    expirationInterval: TimeInterval = 3600,
    completion: @escaping (Swift.Result<Void, Error>) -> Void
)

// Clear prefetched ads from memory
public class func clearPrefetchedPausedAds()

// Dismiss the currently displayed paused ad
public class func hidePausedAd()

Example:

// Full-screen paused ad
let config = SLRPausedAdConfiguration(
    title: "Sponsored Content",
    body: "Check out our latest offers",
    sponsorLogo: UIImage(named: "sponsor"),
    backgroundImage: UIImage(named: "bg")
)
StreamLayer.showPausedAd(.fullScreen(configuration: config))

// Transparent background with VAST
let vastURL = URL(string: "https://example.com/vast.xml")!
StreamLayer.showPausedAd(.transparentBackground(vastTagURL: vastURL))

// Prefetch for later
StreamLayer.prefetchPausedAd(.transparentBackground(vastTagURL: vastURL)) { result in
    switch result {
    case .success: print("Cached")
    case .failure(let error): print("Failed: \(error)")
    }
}

SLRPausedAdType

public enum SLRPausedAdType
CaseDescription
.fullScreen(configuration: SLRPausedAdConfiguration)Full-bleed ad with custom content.
.transparentBackground(vastTagURL: URL, resumeButton: SLRResumeButtonConfiguration? = nil, bypassTouches: Bool = false)Transparent overlay with VAST content.

SLRPausedAdConfiguration

public struct SLRPausedAdConfiguration
PropertyTypeDescription
titleString?Title text.
bodyString?Body/description text.
sponsorLogoUIImage?Sponsor logo image.
backgroundImageUIImage?Background image.
qrCodeQRCodeConfig?Optional QR code.
vastTagURLURL?Optional VAST tag URL.
layoutSLRFullBleedLayoutLayout type (.left, .center, .image).

Initializers:

public init(
    title: String,
    body: String,
    sponsorLogo: UIImage? = nil,
    backgroundImage: UIImage? = nil,
    qrCode: QRCodeConfig? = nil,
    vastTagURL: URL? = nil,
    layout: SLRFullBleedLayout = .left
)

public init(vastTagURL: URL)

SLRPausedAdConfiguration.QRCodeConfig

public struct QRCodeConfig
PropertyTypeDescription
labelStringText near the QR code.
urlStringURL the QR code encodes.
imageUIImage?Pre-generated QR image (SDK generates if nil).

Initializer:

public init(label: String, url: String, image: UIImage? = nil)

SLRResumeButtonConfiguration

public struct SLRResumeButtonConfiguration
PropertyTypeDescription
contentContentButton content type.
positionPositionButton position.

Content:

CaseDescription
.image(UIImage, size: CGSize)Custom image button.
.text(String)Text button.
.hiddenHide the button.

Position:

CaseDescription
.topLeft(insets: UIEdgeInsets)Top-left with insets.
.topRight(insets: UIEdgeInsets)Top-right with insets.
.bottomLeft(insets: UIEdgeInsets)Bottom-left with insets.
.bottomRight(insets: UIEdgeInsets)Bottom-right with insets.
.centerCentered.
.custom((UIView, UIView) -> Void)Custom SnapKit constraints.
.defaultLandscapeBottom-left, landscape defaults.
.defaultPortraitBottom-left, portrait defaults.

Initializer & Convenience methods:

public init(content: Content, position: Position = .defaultLandscape)

public static func image(_ image: UIImage, size: CGSize, position: Position = .defaultLandscape) -> SLRResumeButtonConfiguration
public static func text(_ text: String, position: Position = .defaultLandscape) -> SLRResumeButtonConfiguration
public static var hidden: SLRResumeButtonConfiguration

Events & Actions

SLRActionClicked

public struct SLRActionClicked
PropertyTypeDescription
sourceSourceThe action source.

Source enum:

CaseDescription
.watchPartiesCreateNewButtonUser tapped "Create Watch Party".
.watchPartyLeaveButtonUser tapped "Leave Watch Party".

SLRActionShown

public struct SLRActionShown
PropertyTypeDescription
sourceSourceThe action source.
isShownBoolVisibility state.

Source enum:

CaseDescription
.overlayOverlay visibility changed.
.watchPartyReturnButtonReturn-to-WP button visibility changed.

Data Models

SLRStreamModel

public struct SLRStreamModel
PropertyTypeDescription
eventIdIntEvent ID.
previewStringPreview image URL.
horizontalPreviewStringHorizontal preview URL.
logoStringLogo URL.
smallLogoStringSmall logo URL.
isLiveBoolWhether the stream is live.
titleTextStringTitle text.
timeTextStringTime display text.
streamURLStringStream URL.
slateURLStringSlate image URL.
subtitleStringSubtitle text.
descriptionTextStringDescription.
promotitleStringPromotional title.
schedule[SLRStreamProgram]Program schedule.
videoPlayerTypeSLRVideoPlayerProviderTypeComputed player type.

All properties except videoPlayerType are public internal(set).

SLRStreamProgram

public struct SLRStreamProgram
PropertyTypeDescription
titleStringProgram title.
startTimeStringStart time string.
endTimeStringEnd time string.

Initializer:

public init(title: String, startTime: String, endTime: String)

SLRAuthData

public struct SLRAuthData
PropertyTypeDescription
jwtTokenStringJWT authentication token.
userSLRAuthUserAuthenticated user data.

SLRAuthUser

public struct SLRAuthUser: Codable
PropertyTypeDescription
idStringUser ID.
usernameStringUsername.
nameString?Display name.
avatarString?Avatar URL.
aliasString?User alias.
publicNameString?Unique public name.
isNameEmptyBoolComputed — true if both alias and name are empty.

SLRInviteData

@objc
public class SLRInviteData: NSObject
PropertyTypeDescription
eventIdString?Stream ID associated with the invite.
externalEventIdString?External stream ID.
watchPartyGroupIdString?Watch party group ID.
userIdStringInviter's user ID.
tinodeUserIdStringInviter's Tinode user ID.
usernameString?Inviter's username.
nameString?Inviter's display name.
avatarURL?Inviter's avatar URL.
currentUserSLRAuthenticatedUser?Snapshot of authenticated user.

SLRAuthenticatedUser

@objc
public class SLRAuthenticatedUser: NSObject

Internal-only initializer. Properties: id: String, username: String.

SLREventSession

@objc
public class SLREventSession: NSObject

Returned by StreamLayer.createSession(for:). Properties are internal.

SLRWatchPartySessionMeta

public struct SLRWatchPartySessionMeta
PropertyTypeDescription
myIdStringCurrent user's ID.
tokenStringSession token.
sessionIdStringConference session ID.
topicIdStringTopic/group ID.
apiKeyStringAPI key for the video service.
initialVideoEnabledBoolStart with video on.
initialAudioEnabledBoolStart with audio on.

AuthUser

public class AuthUser: Codable

Used in the standalone Auth Flow.

PropertyTypeDescription
idStringUser ID.
usernameStringUsername.
nameString?Display name.
avatarString?Avatar URL.
aliasString?Alias.
publicNameString?Public name.
isNameEmptyBoolComputed — alias and name both empty.
isPublicNameEmptyBoolComputed — public name empty.

Initializer:

public init(id: String, username: String, name: String?, avatar: String?, alias: String?, publicName: String?)

Audio Management

// Prepare audio session for general playback (call on stream start)
public static func prepareSessionForGeneralAudio() throws

// Deactivate the audio session
public static func closeAudioSession() throws

// Fix lowered volume during/after voice calls
public static func applyVideoSoundFix()

Example:

// When player item is ready
observer = playerItem.observe(\.status, options: [.new]) { item, _ in
    guard item.status == .readyToPlay else { return }
    StreamLayer.applyVideoSoundFix()
}

Push Notifications & Deep Links

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

// Upload APNs device token
public class func uploadDeviceAPNsToken(deviceAPNsToken: String)

// Remove APNs token on logout
public class func removeDeviceAPNsToken()

// Handle Branch/deep link
@objc
public class func handleDeepLink(params: [AnyHashable: Any]?) -> Bool

Example:

// In AppDelegate
func application(_ application: UIApplication,
                 didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
    let token = deviceToken.map { String(format: "%02.2hhx", $0) }.joined()
    StreamLayer.uploadDeviceAPNsToken(deviceAPNsToken: token)
}

// Handle push
func userNotificationCenter(_ center: UNUserNotificationCenter,
                            didReceive response: UNNotificationResponse) {
    StreamLayer.handlePushNotification(center,
                                       userInfo: response.notification.request.content.userInfo,
                                       background: true)
}

Auth Flow (Standalone)

SLRAuthFlow

public class SLRAuthFlow

Standalone authentication flow presented as a full-screen modal.

public init(authProvider: SLRAuthFlowProvider)

public func show(
    from viewController: UIViewController,
    options: StreamLayer.Auth.SLRRequireAuthOptions,
    completion: @escaping (Error?) -> Void
)

Example:

let authFlow = SLRAuthFlow(authProvider: myAuthProvider)
authFlow.show(from: self, options: .all) { error in
    if let error { print("Auth failed: \(error)") }
    else { print("Auth succeeded") }
}

SLRProfileFlow

public class SLRProfileFlow

Standalone profile management flow.

public init(profileProvider: SLRAuthFlowProfileProvider)
public func show(from viewController: UIViewController)

PortraitNavigationController

public class PortraitNavigationController: UINavigationController

Navigation controller locked to portrait orientation. shouldAutorotate returns false, supportedInterfaceOrientations returns [.portrait, .portraitUpsideDown].


Protocols — Delegates & Data Sources

SLROverlayDataSource

public protocol SLROverlayDataSource: AnyObject
MethodDescription
overlayHeight() -> CGFloatProvide the overlay container height.

SLROverlayDelegate

public protocol SLROverlayDelegate: AnyObject

All methods have default (no-op) implementations.

MethodDescription
requestAudioDucking(_ mute: Bool)Reduce player volume for voice calls.
disableAudioDucking()Restore player volume.
prepareAudioSession(for type: SLRAudioSessionType)Configure audio session.
disableAudioSession(for type: SLRAudioSessionType)Release audio session.
shareInviteMessage() -> StringCustom share/invite message text.
waveMessage() -> StringCustom wave/ping message text.
switchStream(to streamId: String)User requested stream switch.
pauseVideo(_ userInitiated: Bool)Pause the video player.
playVideo(_ userInitiated: Bool)Resume the video player.
onPlayerVolumeChange: (() -> Void)?Volume change callback (non-user).
setPlayerVolume(_ volume: Float)Set player volume (0.0-1.0).
getPlayerVolume() -> FloatGet current player volume.
onReturnToWP(isActive: Bool)Return-to-Watch-Party badge visibility.
@MainActor handleActionClicked(_ action: SLRActionClicked) async -> BoolHandle action click events.
handleActionShown(_ action: SLRActionShown)Handle action visibility events.

StreamLayerDelegate

public protocol StreamLayerDelegate: AnyObject
MethodDescription
inviteHandled(invite: SLRInviteData, completion: @escaping (_ cancel: Bool) -> Void)Handle accepted watch party invite. Navigate to the stream, then call completion(false).
requireAuthentication(nameInputOptions: StreamLayer.Auth.SLRRequireAuthOptions, completion: @escaping (Bool) -> Void)SDK requires host-app authentication.

StreamLayerInviteLinkHandler

public protocol StreamLayerInviteLinkHandler: AnyObject
MethodDescription
getInviteLink(for data: [String: AnyObject]) async throws -> URLGenerate a custom invite link from SDK data.

SLRLBarDelegate

public protocol SLRLBarDelegate: AnyObject
MethodDescription
moveRightSide(for points: CGFloat)Adjust right-side position for L-bar.
moveBottomSide(for points: CGFloat)Adjust bottom-side position for L-bar.

SLRSideBarDelegate

public protocol SLRSideBarDelegate: AnyObject
MethodDescription
sideBarApplyContainerFrame(_ frame: CGRect, cornerRadius: CGFloat)Apply sidebar container frame.
sideBarReset()Reset sidebar state.

SLROverlayLoggerDelegate

public protocol SLROverlayLoggerDelegate: AnyObject
MethodDescription
sendLogdata(userInfo: String)Receive logs for Crashlytics.
receiveLogs(userInfo: String)Receive debug logs.

SLRBugseeDelegate

public protocol SLRBugseeDelegate: AnyObject
MethodDescription
setEmail(email: String)Set user email for Bugsee.
clearEmail()Clear Bugsee email.
setAttribute(_ key: String, value: Any)Set a Bugsee attribute.
clearAttribute(_ key: String)Clear a Bugsee attribute.
clearAllAttributes()Clear all Bugsee attributes.
trace(key: String, value: Any)Send a trace event.
event(_ event: String, params: [String: Any])Send a named event.

SLRTimecodeProvider (iOS)

@objc public protocol SLRTimecodeProvider: AnyObject
MethodDescription
getOverallStreamTimeInMillis() -> TimeIntervalOverall stream time in ms.
getEpochTimeCodeInMillis() -> TimeIntervalEpoch timecode in ms.

SLRTimeObservable

public protocol SLRTimeObservable

Matches AVPlayer's time-observation interface.

MethodDescription
addPeriodicTimeObserver(forInterval interval: CMTime, using block: @escaping (CMTime) -> Void) -> AnyAdd periodic observer.
removeTimeObserver(_ observer: Any)Remove time observer.
currentTime() -> CMTimeGet current playback time.

SLRCustomMenuProtocol

public protocol SLRCustomMenuProtocol: AnyObject
MemberTypeDescription
iconImageUIImage?Menu icon (25x25pt @1x).
titleString?Menu item label.
positionInt?Sort priority.
embeddedToNavigationBoolWrap in navigation controller.
build() -> UIViewControllerMethodFactory for the overlay content VC.
overlayContainerTypeSLRDefaultOverlayContainer.TypeCustom overlay container class.

SLRCustomMenuItem

public class SLRCustomMenuItem: SLRCustomMenuProtocol

Concrete implementation of SLRCustomMenuProtocol.

PropertyTypeDescription
iconImageUIImage?Menu icon.
titleString?Menu item label.
positionInt?Always nil (default ordering).
embeddedToNavigationBoolDefault false.
viewControllerUIViewControllerThe overlay content VC.
overlayContainerTypeSLRDefaultOverlayContainer.TypeDefault SLRDefaultOverlayContainer.self.

Initializer:

public init(viewController: UIViewController)

SLRAuthFlowProvider

public protocol SLRAuthFlowProvider
MethodDescription
requestOTP(phoneNumber: String) async throwsSend OTP.
authenticate(phoneNumber: String, code: String) async throws -> AuthUserVerify OTP and authenticate.
setUserName(_ name: String) async throwsSet display name.
setPublicUserName(_ name: String) async throwsSet unique public name.

SLRAuthFlowProfileProvider

public protocol SLRAuthFlowProfileProvider
MemberDescription
termsOfService: String?Terms of service URL.
privacyPolicy: String?Privacy policy URL.
user() -> AuthUser?Get current user.
setUserName(_ name: String) async throwsUpdate name.
updateAvatar(to image: UIImage) async throws -> StringUpload avatar, returns URL.
deleteAvatar()Delete avatar.
logout()Log out.

StatisticsDataOptionsProtocol

public protocol StatisticsDataOptionsProtocol
PropertyTypeDescription
golfStatisticsStringUrlStringStatistics URL.
golfStatisticsPollingTimerIntPolling interval (seconds).

SLRWatchParyServiceProtocol

public protocol SLRWatchParyServiceProtocol
MemberDescription
isConnected: BoolConnection status.
conferenceVolume: DoubleConference audio volume.
isInitialised: BoolWhether the service is initialized.
delegate: SLRWatchPartyServiceDelegate?Event delegate.
initialiseWatchPartyService(meta: SLRWatchPartySessionMeta)Initialize with session meta.
deinitialiseWatchPartyService()Tear down.
joinConference() throwsJoin the voice/video conference.
leaveConferenceSync()Leave synchronously.
leaveConference(completion: (() -> Void)?)Leave with callback.
mute(_ mute: Bool)Mute/unmute audio.
sendVideo(_ send: Bool)Enable/disable video.
switchCamera()Toggle front/back camera.
applySoundFix()Fix lowered volume after calls.

SLRWatchPartyServiceDelegate

public protocol SLRWatchPartyServiceDelegate: AnyObject
MethodDescription
onConferenceConnected()Conference connected.
onConferenceDisconnected(error: Error?)Conference disconnected.
onParticipantStatusChange(userId: String, isActive: Bool)Participant status changed.
onLocalVideoStreamAdded(view: UIView?, userId: String, hasVideo: Bool)Local video stream added.
onLocalVideoStreamRemoved(userId: String)Local video stream removed.
onLocalVideoStreamToggled(view: UIView?, enabled: Bool)Local video toggled.
onLocalAudioStreamToggled(enabled: Bool)Local audio toggled.
onRemoteVideoStreamAdded(view: UIView?, userId: String, hasVideo: Bool, hasAudio: Bool)Remote video stream added.
onRemoteVideoStreamRemoved(userId: String)Remote video stream removed.
onRemoteVideoStreamToggled(view: UIView?, user: String, enabled: Bool)Remote video toggled.
onRemoteAudioStreamToggled(userId: String, enabled: Bool)Remote audio toggled.
onDetectVoiceActivity(userId: String, started: Bool)Voice activity detected.
onConferenceUserJoinedFromAnotherDeviceException()Duplicate device join error.
participantsCountUpdated(count: Int)Participant count changed.
prepareAudioSession()Prepare audio session.
disableAudioSession()Disable audio session.
requestAudioDucking()Request audio ducking.
disableAudioDucking()Disable audio ducking.

SLRGooglePALServiceProtocol

public protocol SLRGooglePALServiceProtocol
MethodDescription
requestNonceManager(baseURL: URL, options: SLRGooglePALOptions, completion: @escaping ((Result<URL, Error>) -> Void))Request nonce manager for PAL.
sendPlaybackStart()Signal playback start.
sendPlaybackEnd()Signal playback end.
sendAdClick()Signal ad click.

tvOS SDK

StreamLayer (tvOS)

final public class StreamLayer

tvOS variant of the SDK entry point.

MemberTypeDescription
sharedStreamLayer!Singleton instance.
configurationSLRConfigurationProtocoltvOS SDK configuration.
delegateStreamLayerTVOSDelegate?tvOS event delegate.
eventSessionProviderSLREventSessionProviderLazy event session provider.

Class Methods

public class func initSDK(with key: String, isStagingEnv: Bool = false)

@discardableResult
public class func createSession(for eventId: String, timeCodeProvider: SLRTimecodeProvider? = nil) -> SLREventSession

public class func createOverlay(
    containerViewController: UIViewController,
    contentView: UIView,
    delegate: StreamLayerTVOSDelegate? = nil
) -> UIViewController

public class func startADBreak()
public class func stopADBreak()
public class func setAnonymousAuth() async throws
public class func clearAuthCreds()

public class func showPausedAd(_ adType: SLRPausedAdType)
public class func prefetchPausedAd(
    _ adType: SLRPausedAdType,
    expirationInterval: TimeInterval = 3600,
    completion: @escaping (Swift.Result<Void, Error>) -> Void
)
public class func clearPrefetchedPausedAds()
public class func hidePausedAd()

public class func registerPALPlugin(_ plugin: SLRGooglePALServiceProtocol)
public class func servicesDebugInfo() -> [(section: String, items: [(title: String, value: String)])]
public class func sdkVersion() -> String

Instance Methods

public func requestDemoStreams(showAllStreams: Bool = true, completion: @escaping (([SLRStreamModel]) -> Void))
public func makeLoggerViewController() -> UIViewController

StreamLayerTVOSDelegate

public protocol StreamLayerTVOSDelegate: AnyObject
MethodDescription
streamLayerDelegateUpdateDuckingState(_ enabled: Bool)Audio ducking state changed.
streamLayerDelegateResumePlaying()Resume video playback.

SLRConfigurationProtocol (tvOS)

public protocol SLRConfigurationProtocol
PropertyTypeDescription
isStreamTimelineEnabledBoolEnable stream timeline features.

SLRConfiguration (tvOS)

public struct SLRConfiguration: SLRConfigurationProtocol
PropertyTypeDescription
isStreamTimelineEnabledBoolStream timeline enabled flag.

SLREventSessionProvider (tvOS)

public class SLREventSessionProvider
PropertyTypeDescription
streamURLUpdate((URL) -> Void)?Stream URL update callback.
streamFailedToUpdate((Error) -> Void)?Stream update failure callback.

SLRTimecodeProvider (tvOS)

public protocol SLRTimecodeProvider: AnyObject
MethodDescription
getOverallTimeInMillis() -> TimeIntervalOverall stream time in ms.
getEpochTimeCodeInMillis() -> TimeIntervalEpoch timecode in ms.

tvOS Ad Types

The tvOS SDK uses SLRStandardAdFullBleedConfiguration (instead of iOS's SLRPausedAdConfiguration):

public struct SLRStandardAdFullBleedConfiguration
PropertyTypeDescription
titleString?Ad title.
bodyString?Ad body.
sponsorLogoUIImage?Sponsor logo.
backgroundImageUIImage?Background image.
qrCodeQRCodeConfig?QR code config.
layoutSLRStandardADFullBleedLayoutLayout (.left, .center, .image).

Initializer:

public init(
    title: String,
    body: String,
    sponsorLogo: UIImage? = nil,
    backgroundImage: UIImage? = nil,
    qrCode: QRCodeConfig? = nil,
    layout: SLRStandardADFullBleedLayout = .left
)

tvOS SLRPausedAdType:

CaseDescription
.fullScreen(configuration: SLRStandardAdFullBleedConfiguration)Full-screen ad.
.transparentBackground(vastTagURL: URL, resumeButton: SLRResumeButtonConfiguration? = nil, bypassTouches: Bool = false)Transparent overlay.

tvOS SLRResumeButtonConfiguration.Position adds .defaultTVOS (bottom-left with tvOS-specific insets).


Enumerations

SLRStyle

public enum SLRStyle: String
CaseRaw Value
.blue"Blue"
.green"Green"
.red"Red"
.stoiximan"Stoiximan"
.betano"Betano"

Static method: public static func from(string: String?) -> SLRStyle

SLROverlayMode

public enum SLROverlayMode: String
CaseDescription
.overlayStandard overlay mode.
.sidebarSidebar mode.

SLRAudioSessionType

public enum SLRAudioSessionType: Int
CaseDescription
.genericGeneral audio playback.
.voiceVoice recording (voice chat).

StreamLayerOverlayType

@objc public enum StreamLayerOverlayType: Int
Case
.twitter
.statistic
.chat
.publicChat
.games
.watchParty
.webView
.debug

SLRNotificationsMode

public struct SLRNotificationsMode: OptionSet
OptionDescription
.messagingChat notifications.
.watchPartyLive Watch Party notifications.
.promotionPromotional notifications.
.arrivalFriend-online notifications.
.twitterTwitter module notifications.
.voteVoting/trivia notifications.
.allAll of the above.
.silentNo notifications.

SLRVideoPlayerProviderType

public enum SLRVideoPlayerProviderType
CaseDescription
.vimeoVimeo player.
.youtubeYouTube player.
.avPlayerNative AVPlayer.

SLRReferenceViewMode

public enum SLRReferenceViewMode
CaseDescription
.verticalReference in vertical orientation only.
.horizontalReference in horizontal orientation only.
.allReference in all orientations.

SLRFullBleedLayout

public enum SLRFullBleedLayout
CaseDescription
.leftLeft-aligned layout.
.centerCenter-aligned layout.
.imageImage-only layout.

SLRDraggableArea

public enum SLRDraggableArea: CaseIterable
Case
.top
.bottom
.left
.right
.fullCover

StreamLayerLocalization

public enum StreamLayerLocalization: String
CaseCode
.systemSystem default
.bolgarianbg
.czhechcs
.deutchde
.greekel
.englishen
.spanishes
.spanishChilies-CL
.spanishEcuadores-EC
.spanishPerues-PE
.frenchfr
.portuguesept
.portugueseBrazilpt-BR
.romanianro
.russianru

SLRStandardADFullBleedLayout (tvOS)

public enum SLRStandardADFullBleedLayout
CaseDescription
.leftLeft-aligned layout.
.centerCenter-aligned layout.
.imageImage-only layout.

Debug & Logging

// Track debug info changes
public class func debugInfo(listener: @escaping (SLRDebugInfo) -> Void)

// Get keyboard-handling exclusions
public class func disableKeyboardHandlingClasses() -> [UIViewController.Type]

// Google PAL plugin registration
public static func registerPALPlugin(_ plugin: SLRGooglePALServiceProtocol)

// Logger initialization
public class func initSwiftBeaverLogger(
    with appID: String,
    appSecret: String,
    encryptionKey: String,
    loggerDelegate: SLROverlayLoggerDelegate? = nil
)