PlayerListener
@objc(BMPPlayerListener)
public protocol PlayerListener : NSObjectProtocol
Defines listener methods for all events available for the Player.
-
Called when the player is ready for immediate playback, because initial audio/video has been downloaded.
Declaration
Swift
@objc optional func onReady(_ event: ReadyEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when the player received an intention to start/resume playback.
Declaration
Swift
@objc optional func onPlay(_ event: PlayEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when playback has been started.
Declaration
Swift
@objc optional func onPlaying(_ event: PlayingEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when the player enters the pause state.
Declaration
Swift
@objc optional func onPaused(_ event: PausedEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when the current playback time has changed.
Declaration
Swift
@objc optional func onTimeChanged(_ event: TimeChangedEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when the duration of the current played media has changed.
Declaration
Swift
@objc optional func onDurationChanged(_ event: DurationChangedEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when the player is about to seek to a new position. Only applies to VoD streams.
Declaration
Swift
@objc optional func onSeek(_ event: SeekEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when seeking has been finished and data is available to continue playback.
Only applies to VoD streams.
Declaration
Swift
@objc optional func onSeeked(_ event: SeekedEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when the player is about to time-shift to a new position. Only applies to Live streams.
Declaration
Swift
@objc optional func onTimeShift(_ event: TimeShiftEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when time shifting has been finished and data is available to continue playback. Only applies to live streams, please refer to onSeeked for VoD streams.
Declaration
Swift
@objc optional func onTimeShifted(_ event: TimeShiftedEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when the player is paused or in buffering state and the timeShift offset has exceeded the available timeShift window.
Declaration
Swift
@objc optional func onDvrWindowExceeded(_ event: DvrWindowExceededEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when the player begins to stall and to buffer due to an empty buffer.
Declaration
Swift
@objc optional func onStallStarted(_ event: StallStartedEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when the player ends stalling, due to enough data in the buffer.
Declaration
Swift
@objc optional func onStallEnded(_ event: StallEndedEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when the current size of the video content has been changed.
Declaration
Swift
@objc optional func onVideoSizeChanged(_ event: VideoSizeChangedEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when the playback of the current media has finished.
Declaration
Swift
@objc optional func onPlaybackFinished(_ event: PlaybackFinishedEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when a player error is encountered.
Declaration
Swift
@objc optional func onPlayerError(_ event: PlayerErrorEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when a source error is encountered.
Declaration
Swift
@objc optional func onSourceError(_ event: SourceErrorEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when a player warning occurs.
Declaration
Swift
@available(*, deprecated, message: "Warnings are now communicated through logs with level `.warning`. These logs are printed to the console by default. You can also access them by providing your own logger to `DebugConfig.logging.logger`\"") @objc optional func onPlayerWarning(_ event: PlayerWarningEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when a source warning occurs.
Declaration
Swift
@available(*, deprecated, message: "Warnings are now communicated through logs with level `.warning`. These logs are printed to the console by default. You can also access them by providing your own logger to `DebugConfig.logging.logger`\"") @objc optional func onSourceWarning(_ event: SourceWarningEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when loading of a new source started. This does not mean that loading of the new manifest has been finished.
Declaration
Swift
@objc optional func onSourceLoad(_ event: SourceLoadEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when a new source is loaded. This does not mean that loading of the new manifest has been finished.
Declaration
Swift
@objc optional func onSourceLoaded(_ event: SourceLoadedEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when the current source will be unloaded.
Declaration
Swift
@objc optional func onSourceUnload(_ event: SourceUnloadEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when the current source has been unloaded.
Declaration
Swift
@objc optional func onSourceUnloaded(_ event: SourceUnloadedEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when the player was destroyed.
Declaration
Swift
@objc optional func onDestroy(_ event: DestroyEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when metadata (i.e. ID3 tags in HLS and EMSG in DASH) are encountered.
Declaration
Swift
@objc optional func onMetadata(_ event: MetadataEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when metadata is parsed.
Declaration
Swift
@objc optional func onMetadataParsed(_ event: MetadataParsedEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when casting to another device, such as a ChromeCast, is available.
Declaration
Swift
@objc optional func onCastAvailable(_ event: CastAvailableEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when the playback on a cast device has been paused.
Declaration
Swift
@objc optional func onCastPaused(_ event: CastPausedEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when the playback on a cast device has been finished.
Declaration
Swift
@objc optional func onCastPlaybackFinished(_ event: CastPlaybackFinishedEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when playback on a cast device has been started.
Declaration
Swift
@objc optional func onCastPlaying(_ event: CastPlayingEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when the cast app is launched successfully.
Declaration
Swift
@objc optional func onCastStarted(_ event: CastStartedEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when casting is initiated, but the user still needs to choose which device should be used.
Declaration
Swift
@objc optional func onCastStart(_ event: CastStartEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when casting to a device is stopped.
Declaration
Swift
@objc optional func onCastStopped(_ event: CastStoppedEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when the time update from the currently used cast device is received.
Declaration
Swift
@objc optional func onCastTimeUpdated(_ event: CastTimeUpdatedEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when a cast device has been chosen and player is waiting for the device to get ready for playback.
Declaration
Swift
@available(tvOS, unavailable) @objc(onCastWaitingForDevice:player:) optional func onCastWaiting(forDevice event: CastWaitingForDeviceEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when a sideloaded subtitle cue has been parsed.
Declaration
Swift
@objc optional func onCueParsed(_ event: CueParsedEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when a subtitle entry transitions into the active status.
Declaration
Swift
@objc optional func onCueEnter(_ event: CueEnterEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when an active subtitle entry transitions into the inactive status.
Declaration
Swift
@objc optional func onCueExit(_ event: CueExitEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when a new
SubtitleTrack
is added.Declaration
Swift
@objc optional func onSubtitleAdded(_ event: SubtitleAddedEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when an external
SubtitleTrack
has been removed so it is possible to update the controls accordingly.Declaration
Swift
@objc optional func onSubtitleRemoved(_ event: SubtitleRemovedEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when the active
SubtitleTrack
is changed.Declaration
Swift
@objc optional func onSubtitleChanged(_ event: SubtitleChangedEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when the player is muted.
Declaration
Swift
@objc optional func onMuted(_ event: MutedEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when the player is unmuted.
Declaration
Swift
@objc optional func onUnmuted(_ event: UnmutedEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when an audio track is added.
Declaration
Swift
@objc optional func onAudioAdded(_ event: AudioAddedEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when an audio track is removed.
Declaration
Swift
@objc optional func onAudioRemoved(_ event: AudioRemovedEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when the audio track is changed.
Declaration
Swift
@objc optional func onAudioChanged(_ event: AudioChangedEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when the playback of an ad has been started.
Declaration
Swift
@objc optional func onAdStarted(_ event: AdStartedEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when the playback of an ad has been finished.
Declaration
Swift
@objc optional func onAdFinished(_ event: AdFinishedEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when the playback of an ad has progressed over a quartile boundary.
Declaration
Swift
@objc optional func onAdQuartile(_ event: AdQuartileEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when the playback of an ad break has been started.
Declaration
Swift
@objc optional func onAdBreakStarted(_ event: AdBreakStartedEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when the playback of an ad break has been finished.
Declaration
Swift
@objc optional func onAdBreakFinished(_ event: AdBreakFinishedEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when an ad manifest was successfully downloaded and parsed and the ad has been added onto the queue.
Declaration
Swift
@objc optional func onAdScheduled(_ event: AdScheduledEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when an ad has been skipped.
Declaration
Swift
@objc optional func onAdSkipped(_ event: AdSkippedEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when the user clicks on the ad.
Declaration
Swift
@objc optional func onAdClicked(_ event: AdClickedEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when ad playback fails.
Declaration
Swift
@objc optional func onAdError(_ event: AdErrorEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when the download of an ad manifest is starting.
Declaration
Swift
@objc optional func onAdManifestLoad(_ event: AdManifestLoadEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when the ad manifest has been successfully loaded.
Declaration
Swift
@objc optional func onAdManifestLoaded(_ event: AdManifestLoadedEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when the current video download quality has changed.
Declaration
Swift
@objc optional func onVideoDownloadQualityChanged(_ event: VideoDownloadQualityChangedEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when the current video playback quality has changed.
Declaration
Swift
@objc optional func onVideoPlaybackQualityChanged(_ event: VideoPlaybackQualityChangedEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when a web download request has finished.
Declaration
Swift
@objc optional func onDownloadFinished(_ event: DownloadFinishedEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when AirPlay playback starts or stops.
Declaration
Swift
@objc optional func onAirPlayChanged(_ event: AirPlayChangedEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when AirPlay is available.
Declaration
Swift
@objc optional func onAirPlayAvailable(_ event: AirPlayAvailableEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when a source config is loaded which has metadata attached or when
metadata
is set on the activeSource
.Declaration
Swift
@objc optional func onSourceMetadataChanged(_ event: SourceMetadataChangedEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when a source was loaded into the
Player
. Seeking and time shifting is allowed as soon as this event is seen.Declaration
Swift
@objc optional func onPlayerActive(_ event: PlayerActiveEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when DRM data is found in a downloaded manifest file. TweaksConfig.nativeHlsParsingEnabled needs to be set to
true
to receive those events.Declaration
Swift
@objc optional func onDrmDataParsed(_ event: DrmDataParsedEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when the
Player
was unloaded.Declaration
Swift
@objc optional func onPlayerInactive(_ event: PlayerInactiveEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when the player transitions between two sources in a playlist.
Declaration
Swift
@objc optional func onPlaylistTransition(_ event: PlaylistTransitionEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when the player transitions from one playback speed to another.
Declaration
Swift
@objc optional func onPlaybackSpeedChanged(_ event: PlaybackSpeedChangedEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when a new
Source
was added to a playlist.Declaration
Swift
@objc optional func onSourceAdded(_ event: SourceAddedEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when a
Source
was removed from a playlist.Declaration
Swift
@objc optional func onSourceRemoved(_ event: SourceRemovedEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when a SharePlay session is started.
Declaration
Swift
@available(iOS 15, tvOS 15, *) @objc optional func onSharePlayStarted(_ event: SharePlayStartedEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event
-
Called when a SharePlay session is ended.
Declaration
Swift
@available(iOS 15, tvOS 15, *) @objc optional func onSharePlayEnded(_ event: SharePlayEndedEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event
-
Called when a
SharePlaySuspension
is started.Declaration
Swift
@available(iOS 15, tvOS 15, *) @objc optional func onSharePlaySuspensionStarted(_ event: SharePlaySuspensionStartedEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event
-
Called when a
SharePlaySuspension
is ended.Declaration
Swift
@available(iOS 15, tvOS 15, *) @objc optional func onSharePlaySuspensionEnded(_ event: SharePlaySuspensionEndedEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event
-
Called for each occurring player event.
Declaration
Swift
@objc optional func onEvent(_ event: Event, player: Player)
Parameters
event
The player event. Use
event.name
orevent is
to check the specific event type.player
The player instance which is associated with the emitted event.
-
Called when visual output is obscured by the
Player
due to insufficient external protection provided by the current device configuration.Declaration
Swift
@objc optional func onOutputObscured(_ event: OutputObscuredEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when visual output is no longer obscured by the
Player
due to sufficient external protection provided by the current device configuration.Declaration
Swift
@objc optional func onOutputUnobscured(_ event: OutputUnobscuredEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.
-
Called when FairPlay license was successfully acquired. The object held by property
contentKeyRequest
on the event can be used for renewing expiring licenses viaSource.drm.fairplay.renewExpiringLicense
APIDeclaration
Swift
@objc optional func onFairplayLicenseAcquired(_ event: FairplayLicenseAcquiredEvent, player: Player)
Parameters
event
An object holding specific event data.
player
The player instance which is associated with the emitted event.