JWAVDelegate
@objc
public protocol JWAVDelegate
This delegate listens for audio events.
-
Reports when the list of available audio tracks is updated.
Note
Analagous to theonAudioTracks
event in version 3.x.Declaration
Swift
func jwplayer(_ player: JWPlayer, audioTracksUpdated levels: [JWMediaSelectionOption])
Parameters
player
The player emitting the event.
levels
An array containing descriptions of the available audio tracks.
-
Reports when the active audio track is changed.
Note
Analagous to theonAudioTrackChanged
event in version 3.x.Declaration
Swift
func jwplayer(_ player: JWPlayer, audioTrackChanged currentLevel: Int)
Parameters
player
The player emitting the event.
currentLevel
The currently selected audio track, expressed as an index into the available audio tracks.
-
Reports when the list of available quality levels is updated. Happens shortly after a playlist item starts playing. Not applicable for HLS.
Note
Analagous to theonLevels
event in version 3.x.Declaration
Swift
func jwplayer(_ player: JWPlayer, qualityLevelsUpdated levels: [JWVideoSource])
Parameters
player
The player emitting the event.
levels
An array containing descriptions of the available quality levels.
-
Reports when the active quality level is changed. Happens in response to e.g. a user clicking the controlbar quality menu or calling setCurrentLevel. Not applicable for HLS.
Note
Analagous to theonLevelsChanged
event in version 3.x.Declaration
Swift
func jwplayer(_ player: JWPlayer, qualityLevelChanged currentLevel: Int)
Parameters
player
The player emitting the event.
currentLevel
The currently selected quality level, expressed as an index into the available quality levels.
-
Reports when the active quality level is changed for HLS. This is different than qualityLevelChanged since this will trigger when adaptive streaming automatically shifts quality or when user shifts quality manually.
Declaration
Swift
@objc optional func jwplayer(_ player: JWPlayer, visualQualityChanged currentVisualQuality: JWVisualQuality)
Parameters
player
The player emitting the event.
currentVisualQuality
The current visual quality level.
-
Reports when caption options become available.
Note
Analagous to theonCaptionList
event in version 3.x.Declaration
Swift
func jwplayer(_ player: JWPlayer, updatedCaptionList options: [JWMediaSelectionOption])
Parameters
player
The player emitting the event.
options
A list of available caption tracks.
-
Reports when a new caption track has been selected.
The supplied index is the newly selected caption track, and can be used to index into the list of options supplied by
updatedCaptionList
Note
Analagous to theonCaptionsChanged
event in version 3.x.Declaration
Swift
func jwplayer(_ player: JWPlayer, captionTrackChanged index: Int)
Parameters
player
The player emitting the event.
index
The index of the currently selected caption track.
-
Reports when a caption is being presented.
Multiple captions may be presented at the same time. These are considered separate lines, but each string may contain multiple lines as well, separated by newline characters.
Declaration
Swift
func jwplayer(_ player: JWPlayer, captionPresented caption: [String], at time: JWTimeData)
Parameters
player
The player emitting the event.
caption
A list of strings being displayed for the caption.
time
The point in time the caption is being presented, and for how long the caption will stay on the screen. If
duration
is 0, the caption will stay on the screen until the next caption is displayed.