SourceListener
@objc(BMPSourceListener)
public protocol SourceListener : NSObjectProtocol
Includes all possible methods that an implementation of this protocol can implement. The corresponding method will be called when an event is emitted (if implemented).
-
Called when the source duration has changed. Not emitted for the initial duration.
Declaration
Swift
@objc optional func onDurationChanged(_ event: DurationChangedEvent, source: Source)
Parameters
event
An object holding specific event data.
source
The source instance which is associated with the emitted event.
-
Called when the
Source
that started loading.Declaration
Swift
@objc optional func onSourceLoad(_ event: SourceLoadEvent, source: Source)
Parameters
event
An object holding specific event data.
source
The source instance which is associated with the emitted event.
-
Called when a
Source
was loaded. This does not mean that the source is immediately ready for playback.Declaration
Swift
@objc optional func onSourceLoaded(_ event: SourceLoadedEvent, source: Source)
Parameters
event
An object holding specific event data.
source
The source instance which is associated with the emitted event.
-
Called when the
Source
started unloading.Declaration
Swift
@objc optional func onSourceUnload(_ event: SourceUnloadEvent, source: Source)
Parameters
event
An object holding specific event data.
source
The source instance which is associated with the emitted event.
-
Called when a
Source
was unloaded.Declaration
Swift
@objc optional func onSourceUnloaded(_ event: SourceUnloadedEvent, source: Source)
Parameters
event
An object holding specific event data.
source
The source instance which is associated with the emitted event.
-
Called when a source warning occurred.
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, source: Source)
Parameters
event
An object holding specific event data.
source
The source instance which is associated with the emitted event.
-
Called when a source error occurred.
Faulty
Source
s in a playlist can be removed from this event listener usingPlayer.playlist.remove(sourceAt:)
. Limitation: The activeSource
cannot be removed. Important: TheSource
has to be removed synchronously.Declaration
Swift
@objc optional func onSourceError(_ event: SourceErrorEvent, source: Source)
Parameters
event
An object holding specific event data.
source
The source instance which is associated with the emitted event.
-
Called when metadata is parsed.
Declaration
Swift
@objc optional func onMetadataParsed(_ event: MetadataParsedEvent, source: Source)
Parameters
event
An object holding specific event data.
source
The source instance which is associated with the emitted event.
-
Called for each occurring player event.
Declaration
Swift
@objc optional func onEvent(_ event: SourceEvent, source: Source)
Parameters
event
An event object holding specific event data. Use
event.name
orevent is Type
to check the specific event type.source
The source instance which is associated with the emitted event.
-
Called when the drm data was parsed for the specific source.
Declaration
Swift
@objc optional func onDrmDataParsed(_ event: DrmDataParsedEvent, source: Source)
Parameters
event
An object holding specific event data.
source
The source instance which is associated with the emitted event.
-
Called when an audio track is added.
Declaration
Swift
@objc optional func onAudioAdded(_ event: AudioAddedEvent, source: Source)
Parameters
event
An object holding specific event data.
source
The source instance which is associated with the emitted event.
-
Called when an audio track is removed.
Declaration
Swift
@objc optional func onAudioRemoved(_ event: AudioRemovedEvent, source: Source)
Parameters
event
An object holding specific event data.
source
The source instance which is associated with the emitted event.
-
Called when the audio track is changed.
Declaration
Swift
@objc optional func onAudioChanged(_ event: AudioChangedEvent, source: Source)
Parameters
event
An object holding specific event data.
source
The source 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, source: Source)
Parameters
event
An object holding specific event data.
source
The source instance which is associated with the emitted event.
-
Called when a new
SubtitleTrack
is added, for example using thePlayer.addSubtitle()
call.Declaration
Swift
@objc optional func onSubtitleAdded(_ event: SubtitleAddedEvent, source: Source)
Parameters
event
An object holding specific event data.
source
The source 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, source: Source)
Parameters
event
An object holding specific event data.
source
The source instance which is associated with the emitted event.
-
Called when the active
SubtitleTrack
is changed.Declaration
Swift
@objc optional func onSubtitleChanged(_ event: SubtitleChangedEvent, source: Source)
Parameters
event
An object holding specific event data.
source
The source 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, source: Source)
Parameters
event
An object holding specific event data.
source
The source 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, source: Source)
Parameters
event
An object holding specific event data.
source
The source 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, source: Source)
Parameters
event
An object holding specific event data.
source
The source instance which is associated with the emitted event.