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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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

    @available(*, deprecated, renamed: "onAirPlayAvailabilityChanged(event:player:﹚")
    @objc
    optional nonisolated 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 availability of AirPlay changed.

    Declaration

    Swift

    @objc
    optional nonisolated func onAirPlayAvailabilityChanged(_ event: AirPlayAvailabilityChangedEvent, 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 active Source.

    Declaration

    Swift

    @objc
    optional nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated 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 nonisolated func onEvent(_ event: Event, player: Player)

    Parameters

    event

    The player event. Use event.name or event 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 nonisolated 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 nonisolated 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 via Source.drm.fairplay.renewExpiringLicense API

    Declaration

    Swift

    @objc
    optional nonisolated 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.

  • Called when a licensing call succeeded.

    Declaration

    Swift

    @objc
    optional nonisolated func onLicenseValidated(_ event: LicenseValidatedEvent, player: Player)

    Parameters

    event

    An object holding specific event data.

    player

    The player instance which is associated with the emitted event.