JWPlayerDelegate

@protocol JWPlayerDelegate <NSObject>

The JWPlayerDelegate protocol defines methods that a delegate of a JWPlayerController object can optionally implement to intervene when player callbacks are captured.

  • This singular API call can be used to gather all information from the player’s API. Note: This will output a large amount of information and may degrade performance if it is used for an extended period of time.

    Declaration

    Objective-C

    - (void)onAll;

Playback

  • Useful for QOE tracking - Triggered the instant a user attempts to play a file. This event fires before both the onPlay and onBeforePlay events.

    Declaration

    Objective-C

    - (void)onPlayAttempt;
  • Fired just before the player begins playing. Unlike the onPlay event, the player will not have begun playing or buffering when triggered, which makes this the right moment to insert preroll ads using playAd().

    Declaration

    Objective-C

    - (void)onBeforePlay;
  • Useful for QOE tracking - Triggered by a video’s first frame event (Or the instant an audio file begins playback). This event pinpoints when content playback begins.

    Declaration

    Objective-C

    - (void)onFirstFrame:(nonnull JWEvent<JWFirstFrameEvent> *)event;
  • Fired when the player enters the ‘playing’ state.

    Declaration

    Objective-C

    - (void)onPlay:(nonnull JWEvent<JWStateChangeEvent> *)event;
  • Fired when the player enters the ‘paused’ state.

    Declaration

    Objective-C

    - (void)onPause:(nonnull JWEvent<JWStateChangeEvent> *)event;
  • Fired when the player enters the ‘idle’ state.

    Declaration

    Objective-C

    - (void)onIdle:(nonnull JWEvent<JWStateChangeEvent> *)event;
  • Fired when the player has initialized in HTML5 and is ready for playback.

    Note

    Player API should not be used before this event.

    Declaration

    Objective-C

    - (void)onReady:(nonnull JWEvent<JWReadyEvent> *)event;
  • Fired just before the player completes playing. Unlike the onComplete event, the player will not have moved on to either showing the replay screen or advancing to the next playlistItem, which makes this the right moment to insert post-roll ads using playAd().

    Declaration

    Objective-C

    - (void)onBeforeComplete;
  • Fired when an item completes playback.

    Declaration

    Objective-C

    - (void)onComplete;

Buffer

Playback Position

  • While the player is playing, this event is fired as the playback position gets updated. This may occur as frequently as 10 times per second.

    Declaration

    Objective-C

    - (void)onTime:(nonnull JWEvent<JWTimeEvent> *)event;
  • Fired after a seek has been requested either by scrubbing the controlbar or through the API.

    Declaration

    Objective-C

    - (void)onSeek:(nonnull JWEvent<JWSeekEvent> *)event;
  • Triggered when content playback resumes after seeking. As opposed to onSeek, this API listener will only trigger when playback actually continues.

    Declaration

    Objective-C

    - (void)onSeeked;

Metadata

  • Fired when new metadata has been broadcasted by the player.

    Declaration

    Objective-C

    - (void)onMeta:(nonnull JWEvent<JWMetaEvent> *)event;

Caption

  • Fired when the list of available captions tracks is updated. Happens shortly after a playlist item starts playing.

    Declaration

    Objective-C

    - (void)onCaptionsList:(nonnull JWEvent<JWCaptionsListEvent> *)event;
  • Fired when the active captions track is changed. Happens in response to e.g. a user clicking the controlbar CC menu or calling setCurrentCaptions.

    Declaration

    Objective-C

    - (void)onCaptionsChanged:(nonnull JWEvent<JWTrackChangedEvent> *)event;

Quality

  • Fired when the list of available quality levels is updated. Happens e.g. shortly after a playlist item starts playing. Not applicable for HLS.

    Declaration

    Objective-C

    - (void)onLevels:(nonnull JWEvent<JWLevelsEvent> *)event;
  • Fired 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.

    Declaration

    Objective-C

    - (void)onLevelsChanged:(nonnull JWEvent<JWLevelsChangedEvent> *)event;

Audio Track

  • Fired when the list of available audio tracks is updated. Happens e.g. shortly after a playlist item starts playing.

    Declaration

    Objective-C

    - (void)onAudioTracks:(nonnull JWEvent<JWLevelsEvent> *)event;
  • Fired when the active audio track is changed. Happens in repsponse to e.g. a user clicking the audio tracks menu or setting the currentAudioTrack JWPlayerController property.

    Declaration

    Objective-C

    - (void)onAudioTrackChanged:(nonnull JWEvent<JWTrackChangedEvent> *)event;

Playlist

  • Fired when a new playlist has been loaded into the player. Note this event is not fired as part of the initial playlist load (playlist is loaded when onReady is called).

    Declaration

    Objective-C

    - (void)onPlaylist:(nonnull JWEvent<JWPlaylistEvent> *)event;
  • Fired when the playlist index changes to a new playlist item. This event occurs before the player begins playing the new playlist item.

    Declaration

    Objective-C

    - (void)onPlaylistItem:(nonnull JWEvent<JWPlaylistItemEvent> *)event;
  • Fired when the player is done playing all items in the playlist. However, if the repeat option is set true, this is never fired.

    Declaration

    Objective-C

    - (void)onPlaylistComplete;

Resize

  • Fired when the player toggles to/from fullscreen. Preceded by a onFullscreenRequested callback.

    Declaration

    Objective-C

    - (void)onFullscreen:(nonnull JWEvent<JWFullscreenEvent> *)event;
  • Fired when a request to toggle fullscreen is received by the player. Precedes a onFullscreen callback when successful.

    Declaration

    Objective-C

    - (void)onFullscreenRequested:(nonnull JWEvent<JWFullscreenEvent> *)event;
  • Fired when the player’s size changes.

    Declaration

    Objective-C

    - (void)onResize:(nonnull JWEvent<JWResizeEvent> *)event;

Controls

  • Fired when controls are enabled or disabled by setting the JWPlayerController controls property to a boolean.

    Declaration

    Objective-C

    - (void)onControls:(nonnull JWEvent<JWControlsEvent> *)event;
  • Fired when a user clicks the video display. Especially useful for wiring your own controls when the built-in ones are disabled. Note the default click action (toggling play/pause) will still occur if controls are enabled.

    Declaration

    Objective-C

    - (void)onDisplayClick;
  • Fired when player control bar appears/disappears. Would not be called if controls set to false.

    Note

    Especially useful for synchronizing custom controls visibility with player control bar.

    Declaration

    Objective-C

    - (void)onControlBarVisible:(nonnull JWEvent<JWControlsEvent> *)event;
  • Fired when the playback rate changes.

    Declaration

    Objective-C

    - (void)onPlaybackRateChanged:(nonnull JWEvent<JWPlaybackRateEvent> *)event;

Viewability

Advertising

  • VAST, IMA and FreeWheel. Fired whenever an ad is requested by the player.

    Declaration

    Objective-C

    - (void)onAdRequest:(nonnull JWAdEvent<JWAdRequestEvent> *)event;
  • VAST, IMA, and FreeWheel. Fired whenever an ad has been skipped.

    Declaration

    Objective-C

    - (void)onAdSkipped:(nonnull JWAdEvent<JWAdDetailEvent> *)event;
  • VAST, IMA, and FreeWheel. Fired whenever an ad has completed playback.

    Declaration

    Objective-C

    - (void)onAdComplete:(nonnull JWAdEvent<JWAdDetailEvent> *)event;
  • VAST, IMA, and FreeWheel. Fired whenever a user clicks an ad to be redirected to its landing page.

    Declaration

    Objective-C

    - (void)onAdClick:(nonnull JWAdEvent<JWAdDetailEvent> *)event;
  • VAST only. Fired whenever an ad contains companions.

    Declaration

    Objective-C

    - (void)onAdCompanions:(nonnull JWAdEvent<JWAdCompanionsEvent> *)event;
  • VAST only. Fired whenever a VMAP tag is loaded.

    Declaration

    Objective-C

    - (void)onAdSchedule:(nonnull JWAdEvent<JWAdScheduleEvent> *)event;
  • VAST, IMA, and FreeWheel. Fired whenever an ad starts playing back. At this point, the VAST tag is loaded and the creative selected.

    Declaration

    Objective-C

    - (void)onAdImpression:(nonnull JWAdEvent<JWAdImpressionEvent> *)event;
  • VAST, IMA, and FreeWheel. Fired whenever an ad starts playing. Will fire after an ad is unpaused.

    Declaration

    Objective-C

    - (void)onAdPlay:(nonnull JWAdEvent<JWAdStateChangeEvent> *)event;
  • VAST, IMA, and FreeWheel. Fired whenever an ad is paused.

    Declaration

    Objective-C

    - (void)onAdPause:
        (nonnull JWAdEvent<JWPauseEvent, JWAdStateChangeEvent> *)event;
  • VAST, IMA, and FreeWheel. Fired while ad playback is in progress.

    Declaration

    Objective-C

    - (void)onAdTime:(nonnull JWAdEvent<JWAdTimeEvent> *)event;
  • VAST, IMA, and FreeWheel. Fired whenever an error prevents the ad from playing.

    Declaration

    Objective-C

    - (void)onAdError:(nonnull JWAdEvent<JWErrorEvent> *)event;
  • VPAID-only (not FreeWheel or IMA). Will trigger when a VPAID ad creative signals to our player that it is starting. This differs from adImpression since the advertisement may not yet be visible.

    Declaration

    Objective-C

    - (void)onAdStarted:(nonnull JWAdEvent<JWAdDetailEvent> *)event;
  • VAST, IMA, and FreeWheel. Fired when new metadata has been broadcasted by the player during an Ad.

    Declaration

    Objective-C

    - (void)onAdMeta:(nonnull JWAdEvent<JWMetaEvent> *)event;
  • Fires after the ad request and immediately before the ad is loaded into the player. Only fires before the first ad inside of an ad break.

    Declaration

    Objective-C

    - (void)onAdBreakStart:(nonnull JWAdEvent<JWAdBreakEvent> *)event;
  • Fires when control is passed back to the player from the ad.

    Declaration

    Objective-C

    - (void)onAdBreakEnd:(nonnull JWAdEvent<JWAdBreakEvent> *)event;
  • VAST only. Fired when a non-fatal warning rises and that is not critical to the playback of an ad.

    Declaration

    Objective-C

    - (void)onAdWarning:(nonnull JWAdEvent<JWErrorEvent> *)event;

Related

Error