-
Notifications
You must be signed in to change notification settings - Fork 217
Media Controller
The MediaController controls playback of video and audio player components.
This example uses the Digit Video component.
"videoPlayer": {
"prototype": "digit/ui/video.reel",
"properties": {
"element": {"#": "videoPlayer"},
"src": "movie.ogg",
"videoController" : {"@": "mediaController"}
}
},
"mediaController": {
"prototype": "montage/core/media-controller",
"properties": {
"autoplay": false
}
}<div data-montage-id="videoPlayer"></div>videoPlayer.videoController.play();-
statusThe current status of the media controller.
-
mediaControllerThe native HTML5
MediaControllerobject. -
positionThe current playback position (in seconds) in the media. Use this to seek in the media.
-
durationThe duration of the media in seconds.
-
autoplayDetermines whether the media should start playing automatically when ready.
-
playbackRateThe current playback rate, where 1.0 indicates normal playback. Use a negative playback rate to reverse playback direction.
-
currentTimeThe actual, current playback position (in seconds).
-
volumeThe sound volume, where 0 is silent and 100 is maximum volume.
-
muteDetermines whether the sound is currently muted. Does not affect the
volumeproperty.
These are the possible values for the status property.
-
EMPTYNo media elements have been attached or no media has been loaded yet.
-
STOPPEDThe media is ready and playback is currently stopped.
-
PLAYINGThe media is currently playing.
-
PAUSEDPlayback is currently paused.
Example:
if (mediaController.status == mediaController.PLAYING) {
// media is playing
}-
play()Start playing the media.
-
pause()Pause playback.
-
unpause()Unpause playback.
-
playPause()Start playback if paused or stopped, otherwise pause the playback.
-
rewind()Set the playback rate to -4.
-
fastForward()Set the playback rate to 4.
-
stop()Stop playback and return to beginning of the media.
-
volumeIncrease()Increase the sound volume by 10.
-
volumeDecrease()Decrease the sound volume by 10.
-
toggleMute()Mute the audio if not already muted, otherwise unmute.