API Reference
Complete reference for every public class, protocol, struct, enum, and method exposed by the StreamLayer SDK.
Table of Contents
- Core — StreamLayer (iOS)
- Authentication
- Configuration
- Overlay & UI
- Watch Party
- Exposed Ads
- Events & Actions
- Data Models
- Audio Management
- Push Notifications & Deep Links
- Auth Flow (Standalone)
- Protocols — Delegates & Data Sources
- tvOS SDK
- Enumerations
Core — StreamLayer (iOS)
StreamLayer
StreamLayerfinal public class StreamLayer: NSObjectMain entry point for the StreamLayer SDK. All SDK functionality is accessed through static methods on this class.
| Member | Signature | Description |
|---|---|---|
| shared | public private(set) static var shared: StreamLayer! | Singleton instance created by initSDK. |
| config | static public var config: StreamLayerConfig | Global SDK configuration. Set before initSDK. |
| theme | static public var theme: SLRTheme | SDK theme / styling entry point. |
| activeController | static private(set) public weak var activeController: SLRWidgetsViewController? | Currently active overlay controller. |
| inviteLinkHandler | public static var inviteLinkHandler: StreamLayerInviteLinkHandler? | Custom invite link handler. Falls back to SDK's internal generator when nil. |
| bugseeDelegate | public 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.
| Parameter | Type | Description |
|---|---|---|
key | String | SDK key from the admin panel. |
isDebug | Bool | Enables verbose logging. Default false. |
delegate | StreamLayerDelegate? | Host-app delegate for invites and auth. |
loggerDelegate | SLROverlayLoggerDelegate? | Optional Crashlytics / log receiver. |
Example:
StreamLayer.initSDK(with: "YOUR_SDK_KEY", isDebug: true, delegate: self)@objc
public class func isInitialized() -> BoolReturns true if the SDK has been initialized.
public class func sdkVersion() -> StringReturns 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
) -> SLREventSessionCreate or update the active event session. Must be called each time the current event changes.
| Parameter | Type | Description |
|---|---|---|
eventId | String | Host-app event ID. |
timecodeProvider | SLRTimecodeProvider? | 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 throwsAuthenticate via host-app bypass token (SSO).
public static func useAnonymousAuth() async throwsSet anonymous authentication for the current user.
public static func isUserAuthorized() -> BoolReturns true if a user is currently authorized.
public static func isUserAnonymous() -> BoolReturns true if the current user is anonymously authenticated.
public static func logout()Logout the current user and clear cached data.
Authentication
StreamLayer.Auth
StreamLayer.Authpublic struct AuthNamespace for authentication-related APIs, accessed as StreamLayer.Auth.
| Method | Signature | Description |
|---|---|---|
| requestOTP | static func requestOTP(phoneNumber: String) async throws | Send OTP to the given phone number. |
| authenticate | static func authenticate(phoneNumber: String, code: String) async throws -> SLRAuthData | Authenticate with phone + OTP code. |
| setUserName | static func setUserName(_ name: String) async throws | Update the user's display name. |
| setPublicUserName | static func setPublicUserName(_ name: String) async throws | Update the user's public/unique name. |
| uploadAvatar | static func uploadAvatar(_ image: UIImage) async throws -> String | Upload a new avatar image. Returns the URL. |
| deleteAvatar | static func deleteAvatar() | Delete the current user's avatar. |
| authenticatedUser | static func authenticatedUser() -> SLRAuthUser? | Snapshot of the currently authenticated user. |
SLRRequireAuthOptions
SLRRequireAuthOptionspublic struct SLRRequireAuthOptions: OptionSet| Option | Description |
|---|---|
.name | Require display name input. |
.publicName | Require public/unique name input. |
.all | Both name and public name. |
.default | Name 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)
StreamLayerConfig (Protocol)public protocol StreamLayerConfig: AnyObjectHost-app configurable SDK settings. Assign to StreamLayer.config before initSDK.
| Property | Type | Default | Description |
|---|---|---|---|
isAlwaysOpened | Bool | false | Keep menu always open in portrait. |
phoneContactsSyncEnabled | Bool | true | Allow contacts access. |
whoIsWatchingEnabled | Bool | true | Show "Who's Watching" button. |
isUserProfileOverlayHidden | Bool | true | Hide profile in menu. |
appStyle | SLRStyle | .blue | SDK color theme. |
notificationsMode | SLRNotificationsMode | .all | Which notifications are visible. |
statisticsDataOptions | StatisticsDataOptionsProtocol? | nil | Statistics overlay data. |
shouldIncludeTopGestureZone | Bool | true | Extra gesture zone above overlay. |
tooltipsEnabled | Bool | true | Show tutorial tooltips. |
enableWatchPartyHistoryList | Bool | true | Show WP history. |
enableWatchPartyDragAndDrop | Bool | true | Draggable user cells in landscape. |
managedGroupConfig | ManagedGroupConfig | default | Managed group session appearance. |
enableConnectionStatusLabel | Bool | false | Show connection status. |
invitesEnable | Bool | true | Enable invite features. |
watchPartyLandscapeInset | UIEdgeInsets | .zero | WP landscape insets. |
triviaBalanceButtonVerticalCustomPadding | UIEdgeInsets | .zero | Trivia button vertical padding. |
triviaBalanceButtonHorizontalCustomPadding | UIEdgeInsets | .zero | Trivia button horizontal padding. |
forceCloseOverlayAfterWPLeaving | Bool | false | Close overlay stack on WP leave. |
watchPartyStatusViewContainerLandscape | UIView? | nil | Custom WP status container (landscape). |
gamificationOptions | SLRGamificationOptions | default | Gamification settings. |
overlayMode | SLROverlayMode | .overlay | Overlay or sidebar mode. |
isSideBarForcingEnabled | Bool | false | Force sidebar in landscape. |
isSideBarSafeAreasEnabled | Bool | false | Sidebar safe-area spacing. |
localization | StreamLayerLocalization | .system | SDK language override. |
enableDebugOverlay | Bool | false | Enable debug overlay. |
isExpandableOverlayEnabled | Bool | true | Allow overlay expansion. |
shouldExpandOnScroll | Bool | false | Expand on scroll vs. pan only. |
wpStatusViewTopOffset | CGFloat | 0.0 | WP status view top offset (portrait). |
pullDownTooltipTopOffset | CGFloat | 0.0 | Pull-down tooltip offset. |
isAccessibilityFontsEnabled | Bool | false | Use Apple accessibility fonts. |
alwaysXToClose | Bool | false | Always show X instead of auto-close. |
isChatFeatureEnable | Bool | false | Enable chat feature. |
isStreamTimelineEnabled | Bool | false | Enable Spoiler Prevention / Delayed ADs. |
StreamLayerSilentModeConfig
StreamLayerSilentModeConfigpublic class StreamLayerSilentModeConfig: StreamLayerConfigPre-configured silent mode: all notifications disabled, WW button hidden, menu hidden.
StreamLayer.config = StreamLayerSilentModeConfig()ManagedGroupConfig
ManagedGroupConfigpublic struct ManagedGroupConfig| Property | Type | Default | Description |
|---|---|---|---|
watchPartyLandscapeInset | UIEdgeInsets | .zero | Managed WP landscape inset. |
watchPartyInitialDraggableArea | SLRDraggableArea | .left | Initial thumbnail position. |
managedGroupOverlayWidth | CGFloat | 300 | Overlay width in landscape. |
Initializers:
public init(
watchPartyLandscapeInset: UIEdgeInsets,
watchPartyInitialDraggableArea: SLRDraggableArea,
managedGroupOverlayWidth: CGFloat
)
public init()SLRGamificationOptions
SLRGamificationOptionspublic struct SLRGamificationOptions| Property | Type | Default | Description |
|---|---|---|---|
globalLeaderBoardEnabled | Bool | false | Show leaderboard tab. |
invitesEnabled | Bool | true | Show invites in onboarding. |
isOnboardingEnabled | Bool | true | Require onboarding before game. |
showGamificationNotificationOnboarding | Bool | true | Show notification onboarding. |
Initializer:
public init(
globalLeaderBoardEnabled: Bool,
invitesEnabled: Bool,
isOnboardingEnabled: Bool,
showGamificationNotificationOnboarding: Bool
)StatisticsDataOptions
StatisticsDataOptionspublic struct StatisticsDataOptions: StatisticsDataOptionsProtocol| Property | Type | Description |
|---|---|---|
golfStatisticsStringUrl | String | Statistics endpoint URL. |
golfStatisticsPollingTimer | Int | Polling 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
) -> SLRWidgetsViewControllerCreate and attach the SDK overlay to your view hierarchy.
| Parameter | Type | Description |
|---|---|---|
mainContainerViewController | UIViewController | Root VC with the container view. |
overlayDelegate | SLROverlayDelegate | Handles audio ducking, stream switching, video control. |
overlayDataSource | SLROverlayDataSource | Provides overlay height. |
sideBarDelegate | SLRSideBarDelegate? | 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
) throwsPresent a specific overlay type. Creates a modal container if createOverlay was not called first.
overlayType | Required 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, .debug | None |
Layout & Visibility
| Method | Description |
|---|---|
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(_:) throws | Allow 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
SLRWidgetsViewControllerpublic class SLRWidgetsViewController: UIViewController, ConnectableThe main overlay view controller returned by createOverlay. Add it as a child view controller to your streaming view.
SLRWatchPartyStatusView
SLRWatchPartyStatusViewpublic class SLRWatchPartyStatusView: UIView, ConnectableDisplays the Watch Party status indicator.
| Property | Type | Description |
|---|---|---|
position | Position | Placement: .left, .right, .top, .bottom, .custom. |
SLRWatchPartyPillButton
SLRWatchPartyPillButtonpublic class SLRWatchPartyPillButton: UIButtonPill-shaped button for Watch Party status display.
SLRDebugInfo
SLRDebugInfopublic class SLRDebugInfoDebug information container. Use with StreamLayer.debugInfo(listener:).
| Property | Type | Description |
|---|---|---|
debugDataUpdateHandler | ((SLRDebugInfo) -> Void)? | Called on every debug data update. |
eventId | String? | Current event ID. |
sdkVersion | String? | SDK version string. |
orgId | String? | Organization ID. |
subEventStatus | String? | Sub-event status. |
lastFeedDescription | String? | 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
)| Parameter | Type | Description |
|---|---|---|
groupId | String | ID of the group to attach. |
title | String | Display title for the session. |
completion | SLRWatchPartySessionCreationBlock | (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)
SLRManagedGroupSession (Protocol)public protocol SLRManagedGroupSession| Member | Type | Description |
|---|---|---|
currentUserId | String | Internal ID of the current user. |
title | String | Session title. |
topicId | String | Topic/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) -> Void | Heartbeat with online participant count. |
sendMessage(_:completion:) | Method | Send a message to the session. |
openWatchParty() | Method | Open the Watch Party overlay. |
openChat() | Method | Open the Chat overlay. |
release(completion:) | Method | Cancel and close the session. |
SLRManagedGroup
SLRManagedGrouppublic struct SLRManagedGroupNested Types
SLRManagedGroup.Message
| Property | Type | Description |
|---|---|---|
userId | String | Sender user ID. |
content | String | Message content. |
date | Date | Timestamp. |
SLRManagedGroup.User
| Property | Type | Description |
|---|---|---|
id | String | Tinode user ID. |
bypassId | String | Bypass/external user ID. |
SLRManagedGroup.Participant
| Property | Type | Description |
|---|---|---|
user | User | User data. |
status | ParticipantStatus | Current status. |
description | String | Computed debug description. |
SLRManagedGroup.ParticipantStatus
| Case | Raw Value | Description |
|---|---|---|
.pending | "PENDING" | Invited, not yet joined. |
.subscribed | "SUBSCRIBED" | Subscribed to the session. |
.onCall | "ON_CALL" | Active in the voice/video call. |
SLRManagedGroup.Event
| Case | Description |
|---|---|
.participantsLoaded(participants:) | Initial participant list loaded. |
.participantUpdated(participant:) | A participant was added or changed. |
.participantRemoved(participant:) | A participant was removed. |
.sessionReleased | Session was released. |
SLRManagedGroupSessionProvider
SLRManagedGroupSessionProviderpublic class SLRManagedGroupSessionProvider| Member | Type | Description |
|---|---|---|
session | SLRManagedGroupSession? | Currently active session. |
SLRManagedGroupSessionProvider.SessionError
SLRManagedGroupSessionProvider.SessionErrorpublic enum SessionError: Error| Case | Description |
|---|---|
.emptyGroupId | Group 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?) -> VoidExposed Ads
Present host-driven ads and promotions over your video stream with a single entry point — StreamLayer.showAd(_:). One method drives every ad surface (full-screen paused ads, transparent WebView / VAST paused ads, and the promotion + sponsor-frame overlays); the surface is selected by the SLRAdType case you pass. The API is available on both iOS and tvOS with the same method names — the small platform differences are called out below.
CallcreateOverlay()firstExposed ads render through the SDK's ad display delegate, which is wired up automatically when you call
createOverlay(). CallshowAd(_:)only after the overlay exists.
For step-by-step integration and per-unit examples, see the Exposed Ads (iOS) and Exposed Ads (tvOS) guides.
// Display an exposed ad or promotion
public class func showAd(_ adType: SLRAdType)
// Prefetch ad content for smooth display
public class func prefetchAd(
_ adType: SLRAdType,
expirationInterval: TimeInterval = 3600,
completion: @escaping (Swift.Result<Void, Error>) -> Void
)
// Clear prefetched ads from memory
public class func clearPrefetchedAds()
// Dismiss the currently displayed exposed ad
public class func hideAd()showAd(_:)
showAd(_:)public class func showAd(_ adType: SLRAdType)Displays an exposed ad. The presentation surface is chosen by the SLRAdType case passed in.
| Parameter | Type | Description |
|---|---|---|
adType | SLRAdType | The ad variant and its configuration to display. |
iPad-only paused variantsOn iOS, the paused-ad variants (
.fullScreen,.transparentBackground,.transparentBackgroundVAST) render on iPad only — calling them on iPhone is a no-op. The promotion surfaces (.overlayPromotion,.sidebarPromotion,.pictureInPicturePromotion,.sideBySidePromotion,.sponsorFrame) work on both iPhone and iPad. On tvOS, every supported surface is available.
prefetchAd(_:expirationInterval:completion:)
prefetchAd(_:expirationInterval:completion:)public class func prefetchAd(
_ adType: SLRAdType,
expirationInterval: TimeInterval = 3600,
completion: @escaping (Swift.Result<Void, Error>) -> Void
)Preloads and caches ad content ahead of time so the ad appears instantly when shown. Prefetching parses the VAST tag (for .transparentBackgroundVAST, and for .fullScreen when a vastTagURL is set) and downloads the referenced images. For .transparentBackground (WebView) ads, prefetching is a no-op since the WKWebView handles its own loading.
| Parameter | Type | Description |
|---|---|---|
adType | SLRAdType | The ad variant to prefetch. |
expirationInterval | TimeInterval | Seconds until the cached ad expires (default 3600 = 1 hour). Use .infinity to cache until manually cleared. |
completion | (Swift.Result<Void, Error>) -> Void | Called with .success(()) once all resources are cached, or .failure(error) on parse/download failure. |
hideAd()
hideAd()public class func hideAd()Manually dismisses the exposed ad currently on screen. No-op when no ad is displayed. On iOS this applies to the iPad paused variants.
clearPrefetchedAds()
clearPrefetchedAds()public class func clearPrefetchedAds()Clears all prefetched ad data from the in-memory cache. Subsequent showAd(_:) calls re-fetch and re-parse as needed.
SLRAdType
SLRAdTypepublic enum SLRAdTypeThe ad variant passed to showAd(_:). Each case carries its own configuration type so every surface can evolve independently.
| Case | Surface | Platforms |
|---|---|---|
.fullScreen(configuration: SLRFullScreenAdConfiguration) | Full-bleed paused ad with title, body, sponsor logo, background — or a VAST-driven ad when configuration.vastTagURL is set. | iOS (iPad), tvOS |
.transparentBackground(url:slot:resumeButton:bypassTouches:) | Transparent paused ad loaded in a WKWebView. Pass url for a direct ad URL, or slot to let the bell-ad proxy build the URL from an ad-server slot. | iOS (iPad); tvOS omits slot |
.transparentBackgroundVAST(vastTagURL:resumeButton:bypassTouches:) | Transparent paused ad that parses a VAST tag, renders the NonLinear / Companion static image, fires <Impression> pixels on display and <NonLinearClickTracking> pixels on tap. | iOS (iPad) only |
.overlayPromotion(configuration: SLROverlayPromotionAdConfiguration) | Host-driven promotion rendered as a full-bleed overlay over the stream. | iOS only |
.sidebarPromotion(configuration: SLRSidebarPromotionAdConfiguration) | Promotion rendered inside the SDK's standard sidebar. Pass banner on the configuration for an L-bar layout. | iOS, tvOS |
.pictureInPicturePromotion(configuration: SLRPictureInPicturePromotionAdConfiguration) | Promotion rendered in a picture-in-picture window next to the stream (falls back to overlay in portrait). | iOS, tvOS |
.sideBySidePromotion(configuration: SLRSideBySidePromotionAdConfiguration) | Promotion rendered side-by-side with the stream (falls back to overlay in portrait). | iOS, tvOS |
.sponsorFrame(configuration: SLRSponsorFrameAdConfiguration) | Sponsor-led overlay that wraps the stream with a sponsor logo + title strip and an optional CTA. | iOS (CTA button), tvOS (CTA QR code) |
resumeButton— customizes the resume/play button on transparent-background variants (seeSLRResumeButtonConfiguration).
bypassTouches— whentrue, taps that miss the ad surface pass through to the host UI underneath the overlay (for example, the video-player controls). Whenfalse(default), the overlay absorbs all touches.
Platform differences (iOS vs tvOS)
| Aspect | iOS | tvOS |
|---|---|---|
.overlayPromotion | Supported | Not available |
.transparentBackgroundVAST | Supported (iPad) | Not available |
.transparentBackground | Accepts url or slot | Accepts url only (no slot) |
.sponsorFrame CTA | CTA button | CTA QR code |
.fullScreen configuration | SLRFullScreenAdConfiguration (layout SLRFullBleedLayout) | SLRFullScreenAdConfiguration (adds qrCode, layout SLRStandardADFullBleedLayout) |
| Paused-variant availability | iPad only | All surfaces available |
SLRFullScreenAdConfiguration
SLRFullScreenAdConfigurationConfiguration for the .fullScreen paused ad. iOS and tvOS expose the same type name with a platform-specific shape.
iOS
public init(
title: String,
body: String,
sponsorLogo: UIImage? = nil,
backgroundImage: UIImage? = nil,
vastTagURL: URL? = nil,
layout: SLRFullBleedLayout = .left
)
// VAST-only convenience initializer
public init(vastTagURL: URL)tvOS
public init(
title: String,
body: String,
sponsorLogo: UIImage? = nil,
backgroundImage: UIImage? = nil,
qrCode: QRCodeConfig? = nil,
layout: SLRStandardADFullBleedLayout = .left
)
// tvOS QR-code CTA
public struct QRCodeConfig {
public init(label: String, url: String, image: UIImage? = nil)
}QR codes are rendered on tvOS only. On iOS, drive CTAs through the ad body / sponsor area or a promotion surface.
Promotion configurations
The promotion cases (.overlayPromotion, .sidebarPromotion, .pictureInPicturePromotion, .sideBySidePromotion) and .sponsorFrame each take a dedicated configuration struct that composes from a shared set of building-block types:
| Building block | Purpose |
|---|---|
SLRAdMedia | Cover image (SLRAdImage, required) plus optional video (SLRAdVideo). |
SLRAdImage | .image(UIImage) or .url(URL). |
SLRAdCTA | Call-to-action: url, title, and optional title/background colors. |
SLRAdSponsor | Optional sponsor attribution rendered above the promotion. |
SLRAdBackground | Optional portrait/landscape background images (iOS). |
SLRAdTiming | Optional countdown + auto-close behavior. |
SLRAdBanner | Optional host-provided banner pinned to the sidebar's bottom slot (L-bar). |
Representative configuration — SLRSidebarPromotionAdConfiguration:
public init(
media: SLRAdMedia,
title: String? = nil,
body: String? = nil,
cta: SLRAdCTA? = nil,
background: SLRAdBackground? = nil,
timing: SLRAdTiming? = nil,
sponsor: SLRAdSponsor? = nil,
banner: SLRAdBanner? = nil
)The other promotion configs (SLROverlayPromotionAdConfiguration, SLRPictureInPicturePromotionAdConfiguration, SLRSideBySidePromotionAdConfiguration) share the same media / title / body / cta / background / timing / sponsor shape; SLRSponsorFrameAdConfiguration carries the sponsor logo, title strip, and CTA (button on iOS, QR code on tvOS).
Example (iOS):
// Full-screen paused ad (iPad)
let config = SLRFullScreenAdConfiguration(
title: "Sponsored Content",
body: "Check out our latest offers",
sponsorLogo: UIImage(named: "sponsor"),
backgroundImage: UIImage(named: "bg")
)
StreamLayer.showAd(.fullScreen(configuration: config))
// Transparent background loaded in a WKWebView from a raw URL
let adURL = URL(string: "https://example.com/pause-ad.html")!
StreamLayer.showAd(.transparentBackground(url: adURL))
// Transparent background loaded by ad-server slot (bell-ad proxy resolves the URL)
StreamLayer.showAd(.transparentBackground(url: adURL, slot: "/12345/pause_ad_ctv"))
// Transparent background that parses a VAST tag and renders the NonLinear / Companion image.
// Fires VAST <Impression> pixels on display and <NonLinearClickTracking> pixels on tap.
let vastURL = URL(string: "https://example.com/vast.xml")!
StreamLayer.showAd(.transparentBackgroundVAST(vastTagURL: vastURL))
// Host-driven sidebar promotion
let promo = SLRSidebarPromotionAdConfiguration(
media: SLRAdMedia(image: .url(imageURL)),
title: "Save 20%",
body: "Limited-time offer"
)
StreamLayer.showAd(.sidebarPromotion(configuration: promo))
// Prefetch for later (works for fullScreen with VAST and for transparentBackgroundVAST)
StreamLayer.prefetchAd(.transparentBackgroundVAST(vastTagURL: vastURL)) { result in
switch result {
case .success: print("Cached")
case .failure(let error): print("Failed: \(error)")
}
}Example (tvOS):
// Full-screen ad with a QR-code CTA
let config = SLRFullScreenAdConfiguration(
title: "Sponsored Content",
body: "Scan to learn more",
sponsorLogo: UIImage(named: "sponsor"),
backgroundImage: UIImage(named: "bg"),
qrCode: .init(label: "Scan me", url: "https://example.com/offer")
)
StreamLayer.showAd(.fullScreen(configuration: config))
// Sidebar (L-bar) promotion
let promo = SLRSidebarPromotionAdConfiguration(media: SLRAdMedia(image: .url(imageURL)))
StreamLayer.showAd(.sidebarPromotion(configuration: promo))Dismissal
An exposed ad is dismissed when the user taps the resume/play button — which triggers playVideo(_:) on SLROverlayDelegate — or when you call hideAd().
Deprecated aliasesThe earlier names are still shipped as deprecated renames and should be migrated:
Deprecated Use instead showPausedAd(_:)showAd(_:)prefetchPausedAd(_:expirationInterval:completion:)prefetchAd(_:expirationInterval:completion:)hidePausedAd()hideAd()clearPrefetchedPausedAds()clearPrefetchedAds()SLRPausedAdTypeSLRAdTypeSLRStandardAdFullBleedConfiguration(tvOS)SLRFullScreenAdConfiguration
SLRPausedAdType (deprecated)
SLRPausedAdType (deprecated)public enum SLRPausedAdType| Case | Description |
|---|---|
.fullScreen(configuration: SLRPausedAdConfiguration) | Full-bleed ad with custom content. Optionally hydrated from a VAST tag URL via SLRPausedAdConfiguration.vastTagURL. |
.transparentBackground(url: URL? = nil, slot: String? = nil, resumeButton: SLRResumeButtonConfiguration? = nil, bypassTouches: Bool = false) | Transparent overlay rendered in a WKWebView. Pass url for a direct ad URL, or pass slot to let the bell-ad proxy build the URL from an ad-server slot identifier. |
.transparentBackgroundVAST(vastTagURL: URL, resumeButton: SLRResumeButtonConfiguration? = nil, bypassTouches: Bool = false) | Transparent overlay that parses a VAST tag, renders the NonLinear / Companion static image, fires <Impression> pixels on display, and fires <NonLinearClickTracking> pixels on user tap. |
bypassTouches— whentrue, taps that miss the ad surface pass through to the host UI underneath the overlay (for example, the video player controls). Whenfalse(default), the overlay absorbs all touches.
SLRPausedAdConfiguration (legacy)
SLRPausedAdConfiguration (legacy)Configuration for the deprecated SLRPausedAdType.fullScreen. New code should use SLRFullScreenAdConfiguration with showAd(.fullScreen(configuration:)).
public struct SLRPausedAdConfiguration| Property | Type | Description |
|---|---|---|
title | String? | Title text. |
body | String? | Body/description text. |
sponsorLogo | UIImage? | Sponsor logo image. |
backgroundImage | UIImage? | Background image. |
vastTagURL | URL? | Optional VAST tag URL. |
layout | SLRFullBleedLayout | Layout type (.left, .center, .image). |
Initializers:
public init(
title: String,
body: String,
sponsorLogo: UIImage? = nil,
backgroundImage: UIImage? = nil,
vastTagURL: URL? = nil,
layout: SLRFullBleedLayout = .left
)
public init(vastTagURL: URL)iOS: QR codes are not rendered on iOS Pause Ads. The
qrCodeparameter that exists in the public initializer for binary compatibility is ignored on iOS — for QR-driven CTAs, use the.fullScreenad's body/sponsor area or build your own. QR codes remain supported on tvOS viaSLRStandardAdFullBleedConfiguration.qrCode.
SLRResumeButtonConfiguration
SLRResumeButtonConfigurationpublic struct SLRResumeButtonConfiguration| Property | Type | Description |
|---|---|---|
content | Content | Button content type. |
position | Position | Button position. |
Content:
| Case | Description |
|---|---|
.image(UIImage, size: CGSize) | Custom image button. |
.text(String) | Text button. |
.hidden | Hide the button. |
Position:
| Case | Description |
|---|---|
.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. |
.center | Centered. |
.custom((UIView, UIView) -> Void) | Custom SnapKit constraints. |
.defaultLandscape | Bottom-left, landscape defaults. |
.defaultPortrait | Bottom-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: SLRResumeButtonConfigurationEvents & Actions
SLRActionClicked
SLRActionClickedpublic struct SLRActionClicked| Property | Type | Description |
|---|---|---|
source | Source | The action source. |
Source enum:
| Case | Description |
|---|---|
.watchPartiesCreateNewButton | User tapped "Create Watch Party". |
.watchPartyLeaveButton | User tapped "Leave Watch Party". |
SLRActionShown
SLRActionShownpublic struct SLRActionShown| Property | Type | Description |
|---|---|---|
source | Source | The action source. |
isShown | Bool | Visibility state. |
Source enum:
| Case | Description |
|---|---|
.overlay | Overlay visibility changed. |
.watchPartyReturnButton | Return-to-WP button visibility changed. |
Data Models
SLRStreamModel
SLRStreamModelpublic struct SLRStreamModel| Property | Type | Description |
|---|---|---|
eventId | Int | Event ID. |
preview | String | Preview image URL. |
horizontalPreview | String | Horizontal preview URL. |
logo | String | Logo URL. |
smallLogo | String | Small logo URL. |
isLive | Bool | Whether the stream is live. |
titleText | String | Title text. |
timeText | String | Time display text. |
streamURL | String | Stream URL. |
slateURL | String | Slate image URL. |
subtitle | String | Subtitle text. |
descriptionText | String | Description. |
promotitle | String | Promotional title. |
schedule | [SLRStreamProgram] | Program schedule. |
videoPlayerType | SLRVideoPlayerProviderType | Computed player type. |
All properties except videoPlayerType are public internal(set).
SLRStreamProgram
SLRStreamProgrampublic struct SLRStreamProgram| Property | Type | Description |
|---|---|---|
title | String | Program title. |
startTime | String | Start time string. |
endTime | String | End time string. |
Initializer:
public init(title: String, startTime: String, endTime: String)SLRAuthData
SLRAuthDatapublic struct SLRAuthData| Property | Type | Description |
|---|---|---|
jwtToken | String | JWT authentication token. |
user | SLRAuthUser | Authenticated user data. |
SLRAuthUser
SLRAuthUserpublic struct SLRAuthUser: Codable| Property | Type | Description |
|---|---|---|
id | String | User ID. |
username | String | Username. |
name | String? | Display name. |
avatar | String? | Avatar URL. |
alias | String? | User alias. |
publicName | String? | Unique public name. |
isNameEmpty | Bool | Computed — true if both alias and name are empty. |
SLRInviteData
SLRInviteData@objc
public class SLRInviteData: NSObject| Property | Type | Description |
|---|---|---|
eventId | String? | Stream ID associated with the invite. |
externalEventId | String? | External stream ID. |
watchPartyGroupId | String? | Watch party group ID. |
userId | String | Inviter's user ID. |
tinodeUserId | String | Inviter's Tinode user ID. |
username | String? | Inviter's username. |
name | String? | Inviter's display name. |
avatar | URL? | Inviter's avatar URL. |
currentUser | SLRAuthenticatedUser? | Snapshot of authenticated user. |
SLRAuthenticatedUser
SLRAuthenticatedUser@objc
public class SLRAuthenticatedUser: NSObjectInternal-only initializer. Properties: id: String, username: String.
SLREventSession
SLREventSession@objc
public class SLREventSession: NSObjectReturned by StreamLayer.createSession(for:). Properties are internal.
SLRWatchPartySessionMeta
SLRWatchPartySessionMetapublic struct SLRWatchPartySessionMeta| Property | Type | Description |
|---|---|---|
myId | String | Current user's ID. |
token | String | Session token. |
sessionId | String | Conference session ID. |
topicId | String | Topic/group ID. |
apiKey | String | API key for the video service. |
initialVideoEnabled | Bool | Start with video on. |
initialAudioEnabled | Bool | Start with audio on. |
AuthUser
AuthUserpublic class AuthUser: CodableUsed in the standalone Auth Flow.
| Property | Type | Description |
|---|---|---|
id | String | User ID. |
username | String | Username. |
name | String? | Display name. |
avatar | String? | Avatar URL. |
alias | String? | Alias. |
publicName | String? | Public name. |
isNameEmpty | Bool | Computed — alias and name both empty. |
isPublicNameEmpty | Bool | Computed — 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]?) -> BoolExample:
// 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
SLRAuthFlowpublic class SLRAuthFlowStandalone 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
SLRProfileFlowpublic class SLRProfileFlowStandalone profile management flow.
public init(profileProvider: SLRAuthFlowProfileProvider)
public func show(from viewController: UIViewController)PortraitNavigationController
PortraitNavigationControllerpublic class PortraitNavigationController: UINavigationControllerNavigation controller locked to portrait orientation. shouldAutorotate returns false, supportedInterfaceOrientations returns [.portrait, .portraitUpsideDown].
Protocols — Delegates & Data Sources
SLROverlayDataSource
SLROverlayDataSourcepublic protocol SLROverlayDataSource: AnyObject| Method | Description |
|---|---|
overlayHeight() -> CGFloat | Provide the overlay container height. |
SLROverlayDelegate
SLROverlayDelegatepublic protocol SLROverlayDelegate: AnyObjectAll methods have default (no-op) implementations.
| Method | Description |
|---|---|
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() -> String | Custom share/invite message text. |
waveMessage() -> String | Custom wave/ping message text. |
switchStream(to streamId: String) | User requested stream switch. |
pauseVideo(_ userInitiated: Bool) | Pause the video player. |
streamLayerDelegateAdDidStart() | A StreamLayer ad began presenting. |
streamLayerDelegateAdDidFinish() | A StreamLayer ad finished; resume video. |
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() -> Float | Get current player volume. |
onReturnToWP(isActive: Bool) | Return-to-Watch-Party badge visibility. |
@MainActor handleActionClicked(_ action: SLRActionClicked) async -> Bool | Handle action click events. |
handleActionShown(_ action: SLRActionShown) | Handle action visibility events. |
StreamLayerDelegate
StreamLayerDelegatepublic protocol StreamLayerDelegate: AnyObject| Method | Description |
|---|---|
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
StreamLayerInviteLinkHandlerpublic protocol StreamLayerInviteLinkHandler: AnyObject| Method | Description |
|---|---|
getInviteLink(for data: [String: AnyObject]) async throws -> URL | Generate a custom invite link from SDK data. |
SLRLBarDelegate
SLRLBarDelegatepublic protocol SLRLBarDelegate: AnyObject| Method | Description |
|---|---|
moveRightSide(for points: CGFloat) | Adjust right-side position for L-bar. |
moveBottomSide(for points: CGFloat) | Adjust bottom-side position for L-bar. |
SLRSideBarDelegate
SLRSideBarDelegatepublic protocol SLRSideBarDelegate: AnyObject| Method | Description |
|---|---|
sideBarApplyContainerFrame(_ frame: CGRect, cornerRadius: CGFloat) | Apply sidebar container frame. |
sideBarReset() | Reset sidebar state. |
SLROverlayLoggerDelegate
SLROverlayLoggerDelegatepublic protocol SLROverlayLoggerDelegate: AnyObject| Method | Description |
|---|---|
sendLogdata(userInfo: String) | Receive logs for Crashlytics. |
receiveLogs(userInfo: String) | Receive debug logs. |
SLRBugseeDelegate
SLRBugseeDelegatepublic protocol SLRBugseeDelegate: AnyObject| Method | Description |
|---|---|
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)
SLRTimecodeProvider (iOS)@objc public protocol SLRTimecodeProvider: AnyObject| Method | Description |
|---|---|
getOverallStreamTimeInMillis() -> TimeInterval | Overall stream time in ms. |
getEpochTimeCodeInMillis() -> TimeInterval | Epoch timecode in ms. |
SLRTimeObservable
SLRTimeObservablepublic protocol SLRTimeObservableMatches AVPlayer's time-observation interface.
| Method | Description |
|---|---|
addPeriodicTimeObserver(forInterval interval: CMTime, using block: @escaping (CMTime) -> Void) -> Any | Add periodic observer. |
removeTimeObserver(_ observer: Any) | Remove time observer. |
currentTime() -> CMTime | Get current playback time. |
SLRCustomMenuProtocol
SLRCustomMenuProtocolpublic protocol SLRCustomMenuProtocol: AnyObject| Member | Type | Description |
|---|---|---|
iconImage | UIImage? | Menu icon (25x25pt @1x). |
title | String? | Menu item label. |
position | Int? | Sort priority. |
embeddedToNavigation | Bool | Wrap in navigation controller. |
build() -> UIViewController | Method | Factory for the overlay content VC. |
overlayContainerType | SLRDefaultOverlayContainer.Type | Custom overlay container class. |
SLRCustomMenuItem
SLRCustomMenuItempublic class SLRCustomMenuItem: SLRCustomMenuProtocolConcrete implementation of SLRCustomMenuProtocol.
| Property | Type | Description |
|---|---|---|
iconImage | UIImage? | Menu icon. |
title | String? | Menu item label. |
position | Int? | Always nil (default ordering). |
embeddedToNavigation | Bool | Default false. |
viewController | UIViewController | The overlay content VC. |
overlayContainerType | SLRDefaultOverlayContainer.Type | Default SLRDefaultOverlayContainer.self. |
Initializer:
public init(viewController: UIViewController)SLRAuthFlowProvider
SLRAuthFlowProviderpublic protocol SLRAuthFlowProvider| Method | Description |
|---|---|
requestOTP(phoneNumber: String) async throws | Send OTP. |
authenticate(phoneNumber: String, code: String) async throws -> AuthUser | Verify OTP and authenticate. |
setUserName(_ name: String) async throws | Set display name. |
setPublicUserName(_ name: String) async throws | Set unique public name. |
SLRAuthFlowProfileProvider
SLRAuthFlowProfileProviderpublic protocol SLRAuthFlowProfileProvider| Member | Description |
|---|---|
termsOfService: String? | Terms of service URL. |
privacyPolicy: String? | Privacy policy URL. |
user() -> AuthUser? | Get current user. |
setUserName(_ name: String) async throws | Update name. |
updateAvatar(to image: UIImage) async throws -> String | Upload avatar, returns URL. |
deleteAvatar() | Delete avatar. |
logout() | Log out. |
StatisticsDataOptionsProtocol
StatisticsDataOptionsProtocolpublic protocol StatisticsDataOptionsProtocol| Property | Type | Description |
|---|---|---|
golfStatisticsStringUrl | String | Statistics URL. |
golfStatisticsPollingTimer | Int | Polling interval (seconds). |
SLRWatchParyServiceProtocol
SLRWatchParyServiceProtocolpublic protocol SLRWatchParyServiceProtocol| Member | Description |
|---|---|
isConnected: Bool | Connection status. |
conferenceVolume: Double | Conference audio volume. |
isInitialised: Bool | Whether the service is initialized. |
delegate: SLRWatchPartyServiceDelegate? | Event delegate. |
initialiseWatchPartyService(meta: SLRWatchPartySessionMeta) | Initialize with session meta. |
deinitialiseWatchPartyService() | Tear down. |
joinConference() throws | Join 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
SLRWatchPartyServiceDelegatepublic protocol SLRWatchPartyServiceDelegate: AnyObject| Method | Description |
|---|---|
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
SLRGooglePALServiceProtocolpublic protocol SLRGooglePALServiceProtocol| Method | Description |
|---|---|
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)
StreamLayer (tvOS)final public class StreamLayertvOS variant of the SDK entry point.
| Member | Type | Description |
|---|---|---|
shared | StreamLayer! | Singleton instance. |
configuration | SLRConfigurationProtocol | tvOS SDK configuration. |
delegate | StreamLayerTVOSDelegate? | tvOS event delegate. |
eventSessionProvider | SLREventSessionProvider | Lazy 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() -> StringInstance Methods
public func requestDemoStreams(showAllStreams: Bool = true, completion: @escaping (([SLRStreamModel]) -> Void))
public func makeLoggerViewController() -> UIViewControllerStreamLayerTVOSDelegate
StreamLayerTVOSDelegatepublic protocol StreamLayerTVOSDelegate: AnyObject| Method | Description |
|---|---|
streamLayerDelegateUpdateDuckingState(_ enabled: Bool) | Audio ducking state changed. |
streamLayerDelegateAdDidStart(_ info: SLRAdInfo) | A StreamLayer ad began presenting (optional). |
streamLayerDelegateAdDidFinish(_ info: SLRAdInfo) | A StreamLayer ad finished; resume playback when info.isPausedAd (required). |
SLRAdInfo carries a single field, isPausedAd: Bool — whether the ad paused the stream, so the host resumes playback when the ad finishes.
SLRConfigurationProtocol (tvOS)
SLRConfigurationProtocol (tvOS)public protocol SLRConfigurationProtocol| Property | Type | Description |
|---|---|---|
isStreamTimelineEnabled | Bool | Enable stream timeline features. |
SLRConfiguration (tvOS)
SLRConfiguration (tvOS)public struct SLRConfiguration: SLRConfigurationProtocol| Property | Type | Description |
|---|---|---|
isStreamTimelineEnabled | Bool | Stream timeline enabled flag. |
SLREventSessionProvider (tvOS)
SLREventSessionProvider (tvOS)public class SLREventSessionProvider| Property | Type | Description |
|---|---|---|
streamURLUpdate | ((URL) -> Void)? | Stream URL update callback. |
streamFailedToUpdate | ((Error) -> Void)? | Stream update failure callback. |
SLRTimecodeProvider (tvOS)
SLRTimecodeProvider (tvOS)public protocol SLRTimecodeProvider: AnyObject| Method | Description |
|---|---|
getOverallTimeInMillis() -> TimeInterval | Overall stream time in ms. |
getEpochTimeCodeInMillis() -> TimeInterval | Epoch timecode in ms. |
tvOS Ad Types
tvOS exposes the same StreamLayer.showAd(_:) / prefetchAd(...) / hideAd() / clearPrefetchedAds() API and the same SLRAdType enum as iOS — see Exposed Ads for the full method and case reference. The tvOS SLRAdType supports .fullScreen, .transparentBackground (no slot), .sidebarPromotion, .pictureInPicturePromotion, .sideBySidePromotion, and .sponsorFrame (.overlayPromotion and .transparentBackgroundVAST are iOS-only).
The tvOS .fullScreen configuration adds a QR-code CTA:
public struct SLRFullScreenAdConfiguration
public init(
title: String,
body: String,
sponsorLogo: UIImage? = nil,
backgroundImage: UIImage? = nil,
qrCode: QRCodeConfig? = nil,
layout: SLRStandardADFullBleedLayout = .left
)
// QR-code CTA (tvOS only)
public struct QRCodeConfig {
public init(label: String, url: String, image: UIImage? = nil)
}| Property | Type | Description |
|---|---|---|
title | String? | Ad title. |
body | String? | Ad body. |
sponsorLogo | UIImage? | Sponsor logo. |
backgroundImage | UIImage? | Background image. |
qrCode | QRCodeConfig? | QR code CTA config. |
layout | SLRStandardADFullBleedLayout | Layout (.left, .center, .image). |
SLRStandardAdFullBleedConfigurationis a deprecated alias ofSLRFullScreenAdConfiguration;SLRPausedAdTypeis a deprecated alias ofSLRAdType. tvOSSLRResumeButtonConfiguration.Positionadds.defaultTVOS(bottom-left with tvOS-specific insets).
Enumerations
SLRStyle
SLRStylepublic enum SLRStyle: String| Case | Raw Value |
|---|---|
.blue | "Blue" |
.green | "Green" |
.red | "Red" |
.stoiximan | "Stoiximan" |
.betano | "Betano" |
Static method: public static func from(string: String?) -> SLRStyle
SLROverlayMode
SLROverlayModepublic enum SLROverlayMode: String| Case | Description |
|---|---|
.overlay | Standard overlay mode. |
.sidebar | Sidebar mode. |
SLRAudioSessionType
SLRAudioSessionTypepublic enum SLRAudioSessionType: Int| Case | Description |
|---|---|
.generic | General audio playback. |
.voice | Voice recording (voice chat). |
StreamLayerOverlayType
StreamLayerOverlayType@objc public enum StreamLayerOverlayType: Int| Case |
|---|
.twitter |
.statistic |
.chat |
.publicChat |
.games |
.watchParty |
.webView |
.debug |
SLRNotificationsMode
SLRNotificationsModepublic struct SLRNotificationsMode: OptionSet| Option | Description |
|---|---|
.messaging | Chat notifications. |
.watchParty | Live Watch Party notifications. |
.promotion | Promotional notifications. |
.arrival | Friend-online notifications. |
.twitter | Twitter module notifications. |
.vote | Voting/trivia notifications. |
.all | All of the above. |
.silent | No notifications. |
SLRVideoPlayerProviderType
SLRVideoPlayerProviderTypepublic enum SLRVideoPlayerProviderType| Case | Description |
|---|---|
.vimeo | Vimeo player. |
.youtube | YouTube player. |
.avPlayer | Native AVPlayer. |
SLRReferenceViewMode
SLRReferenceViewModepublic enum SLRReferenceViewMode| Case | Description |
|---|---|
.vertical | Reference in vertical orientation only. |
.horizontal | Reference in horizontal orientation only. |
.all | Reference in all orientations. |
SLRFullBleedLayout
SLRFullBleedLayoutpublic enum SLRFullBleedLayout| Case | Description |
|---|---|
.left | Left-aligned layout. |
.center | Center-aligned layout. |
.image | Image-only layout. |
SLRDraggableArea
SLRDraggableAreapublic enum SLRDraggableArea: CaseIterable| Case |
|---|
.top |
.bottom |
.left |
.right |
.fullCover |
StreamLayerLocalization
StreamLayerLocalizationpublic enum StreamLayerLocalization: String| Case | Code |
|---|---|
.system | System default |
.bolgarian | bg |
.czhech | cs |
.deutch | de |
.greek | el |
.english | en |
.spanish | es |
.spanishChili | es-CL |
.spanishEcuador | es-EC |
.spanishPeru | es-PE |
.french | fr |
.portuguese | pt |
.portugueseBrazil | pt-BR |
.romanian | ro |
.russian | ru |
SLRStandardADFullBleedLayout (tvOS)
SLRStandardADFullBleedLayout (tvOS)public enum SLRStandardADFullBleedLayout| Case | Description |
|---|---|
.left | Left-aligned layout. |
.center | Center-aligned layout. |
.image | Image-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
)Updated 8 days ago
