Skip to main content

MediaPlayerController

Purpose​

A thin stimulus controller wrapper around the native HTML5 video and audio tag controls.

Provides the following basic interactions:

  • Play
  • Pause
  • Seek
  • Restart

See https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/ for more information.

Actions​

ActionPurpose
playPlay the media
pausePause the media
restartSet the player to the start of the media
seekAdvance the player by 5 seconds

Targets​

TargetPurposeDefault
mediaThe <video> or <audio> to be controlled-

Classes​

ClassPurposeDefault
---

Values​

ValueTypeDescriptionDefault
----

Events​

EventWhenDispatched onevent.detail
----

Side Effects​

None

How to Use​

This controller is just a thin wrapper around the Javascript controls for HTML5 <video> and <audio> tags.