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
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.
Property
Type
Description
position
Position
Placement: .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:).
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)
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
public struct SLRManagedGroup
Nested 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
public class SLRManagedGroupSessionProvider
Member
Type
Description
session
SLRManagedGroupSession?
Currently active session.
SLRManagedGroupSessionProvider.SessionError
public 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?) -> 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)")
}
}
public init(label: String, url: String, image: UIImage? = nil)
SLRResumeButtonConfiguration
public 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: SLRResumeButtonConfiguration
Events & Actions
SLRActionClicked
public 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
public 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
public 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
public 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)
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
// 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
)