Playback

These API calls are used to retrieve and change the current playback state of the player.

Endpoints

MethodDescription
.play()Sets the play state of the JW Player. Calling play() while media is playing does nothing.
.pause()Pauses playback, changing the state of JW Player from playing to paused. Calling pause() while media is already paused does nothing.
.stop()Stops the player, returning it to the idle state.
.getState()Returns the player's current playback state.
.getPlaybackRate()NA
.setPlaybackRate(rate)NA


Events

MethodDescription
.on('autostartNotAllowed')NA
.on('play')Fired when the player enters the playing state
.on('pause')Fired when the player enters the paused state
.on('playAttemptFailed')Fired when playback is aborted or blocked. A failed play attempt does not result in a play. Pausing the video or changing the media results in play attempts being aborted. In mobile browsers play attempts are blocked when not started by a user gesture.
.on('buffer')Fired when the player starts playback and when the player enters a buffering state.
.on('idle')Fired when the player enters the idle state.
.on('complete')Fires each time the end of a video is reached.
.on('firstFrame')Use this to determine the period of time between a user pressing play and the same user viewing their content. Triggered by a video's first frame event (or the instant an audio file begins playback). This event pinpoints when content playback begins.
.on('error')Signals a critical error in the playback process.
.on('warning')Signals a failure that is not critical to the setup or playback process.
.on('playbackRateChanged')Fired when the playback rate has been changed.