A simple facade for dispatching media requests to the nearest media player element.
Section titled setTarget
Set the event target from which to dispatch media requests events from. The events should bubble up from this target to the player element.
Section titled getPlayer
Returns the current player instance. This method will attempt to find the player by
searching up from either the given
target or default target set via
Section titled startLoading
media-start-loading-request event to start the media loading process. This will
only work if the media player has been initialized with a custom loading strategy.
media-play-request event to begin/resume media playback.
Section titled pause
media-pause-request event to pause media playback.
media-mute-request event to set the media volume to mute (0).
Section titled unmute
media-unmute-request event to unmute the media volume and set it back to it’s
Section titled enterFullscreen
media-enter-fullscreen-request event to enter fullscreen on the given target.
Section titled exitFullscreen
media-exit-fullscreen-request event to exit fullscreen on the given target.
Section titled enterPictureInPicture
media-enter-pip-request event to enter picture-in-picture mode.
Section titled exitPictureInPicture
media-exit-pip-request event to exit picture-in-picture mode.
Section titled lockScreenOrientation
media-orientation-lock-request event to lock the screen orientation to the given
Section titled unlockScreenOrientation
media-orientation-unlock-request event to unlock the screen orientation.
Section titled seeking
media-seeking-request event to notify the media player that a seeking process is
happening to the given time. This method will not update the current time, complete the process
by calling seek.
media-seek-request event to notify the media player that a seeking operation has
completed and to seek to the given time. This is generally called after a series
of seeking calls.
Section titled seekToLiveEdge
media-live-edge-request event to seek to the live edge.
Section titled changeVolume
media-volume-change-request event to update the media volume to the given level which
is a value between 0 and 1.
Section titled changeAudioTrack
media-audio-track-change-request event change to the audio track at the given index.
Section titled changeQuality
media-quality-change-request event to change to the video quality at the given index.
The special value
-1 represents auto quality selection.
Section titled requestAutoQuality
Request auto quality selection. This is simply shorthand for
Section titled changeTextTrackMode
media-text-track-change event to change the mode of the text track at the given index.
Section titled changePlaybackRate
media-rate-change-request event to change the media playback rate.
Section titled pauseControls
media-pause-controls-request event to pause controls idle tracking. Pausing
tracking will result in the controls being visible until
is called. This method is generally used when building custom controls and you’d like to prevent
the UI from disappearing.
Section titled resumeControls
media-resume-controls-request event to resume idle tracking on controls. See
pauseControls for more information.
Section titled togglePaused
Dispatch requests to toggle the media playback state.
Section titled toggleControls
Dispatch requests to toggle the controls visibility.
Section titled toggleMuted
Dispatch requests to toggle the media muted state.
Section titled toggleFullscreen
Dispatch requests to toggle the media fullscreen state on the given target.
Section titled togglePictureInPicture
Dispatch requests to toggle the media picture-in-picture mode.
Section titled toggleCaptions
Dispatch requests to toggle the current media captions text track mode.
Section titled disableCaptions
Turn captions off.