JWAVDelegate
@objc
public protocol JWAVDelegate
This delegate listens for audio events.
-
Reports when the list of available audio tracks is updated.
Note
Analagous to theonAudioTracksevent in version 3.x.Declaration
Swift
func jwplayer(_ player: JWPlayer, audioTracksUpdated levels: [JWMediaSelectionOption])Parameters
playerThe player emitting the event.
levelsAn array containing descriptions of the available audio tracks.
-
Reports when the active audio track is changed.
Note
Analagous to theonAudioTrackChangedevent in version 3.x.Declaration
Swift
func jwplayer(_ player: JWPlayer, audioTrackChanged currentLevel: Int)Parameters
playerThe player emitting the event.
currentLevelThe 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 theonLevelsevent in version 3.x.Declaration
Swift
func jwplayer(_ player: JWPlayer, qualityLevelsUpdated levels: [JWVideoSource])Parameters
playerThe player emitting the event.
levelsAn 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 theonLevelsChangedevent in version 3.x.Declaration
Swift
func jwplayer(_ player: JWPlayer, qualityLevelChanged currentLevel: Int)Parameters
playerThe player emitting the event.
currentLevelThe 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
playerThe player emitting the event.
currentVisualQualityThe current visual quality level.
-
Reports when caption options become available.
Note
Analagous to theonCaptionListevent in version 3.x.Declaration
Swift
func jwplayer(_ player: JWPlayer, updatedCaptionList options: [JWMediaSelectionOption])Parameters
playerThe player emitting the event.
optionsA 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
updatedCaptionListNote
Analagous to theonCaptionsChangedevent in version 3.x.Declaration
Swift
func jwplayer(_ player: JWPlayer, captionTrackChanged index: Int)Parameters
playerThe player emitting the event.
indexThe 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
playerThe player emitting the event.
captionA list of strings being displayed for the caption.
timeThe point in time the caption is being presented, and for how long the caption will stay on the screen. If
durationis 0, the caption will stay on the screen until the next caption is displayed.
JWAVDelegate Protocol Reference