limestone/VideoPlayer
Provides Limestone-themed video player components.
Members
Section titled “Members ”VideoPlayer Component
Section titled “VideoPlayer   Component ”A standard HTML5 video player for Limestone. It behaves, responds to, and operates like a
<video> tag in its support for <source>. It also accepts custom tags such as
<infoComponents> for displaying additional information in the title area and <MediaControls>
for handling media playback controls and adding more controls.
Example usage:
<VideoPlayer title="Hilarious Cat Video" poster="https://my.cat.videos/boots-poster.jpg">
<source src="https://my.cat.videos/boots.mp4" type="video/mp4" />
<infoComponents>A video about my cat Boots, wearing boots.</infoComponents>
<MediaControls>
<leftComponents><Button backgroundOpacity="translucent" icon="star" /></leftComponents>
<rightComponents><Button backgroundOpacity="translucent" icon="notification" /></rightComponents>
<Button backgroundOpacity="translucent">Add To Favorites</Button>
<Button backgroundOpacity="translucent" icon="search" />
</MediaControls>
</VideoPlayer>To invoke methods (e.g.: fastForward()) or get the current state (getMediaState()), store a
ref to the VideoPlayer within your component:
...
setVideoPlayer = (node) => {
this.videoPlayer = node;
}
play () {
this.videoPlayer.play();
}
render () {
return (
<VideoPlayer ref={this.setVideoPlayer} />
);
} Wrapped with:
ui/Slottableui/Slottable.Slottable
Video Component
Section titled “Video   Component ”Provides support for more advanced video configurations for VideoPlayer.
Custom Video Tag
<VideoPlayer>
<Video mediaComponent="custom-video-element">
<source src="path/to/source.mp4" />
</Video>
</VideoPlayer>Preload Video Source
<VideoPlayer>
<Video>
<source src="path/to/source.mp4" />
<source src="path/to/preload-source.mp4" slot="preloadSource" />
</Video>
</VideoPlayer> Wrapped with:
ui/Slottableui/Slottable.Slottable
Properties
autoPlay
Section titled “autoPlay”Video plays automatically.
Default: falseVideo component to use.
The default ('video') renders an HTMLVideoElement. Custom video components must have
a similar API structure, exposing the following APIs:
Properties:
currentTime{Number} - Playback index of the media in secondsduration{Number} - Media's entire duration in secondserror{Boolean} -trueif video playback has errored.loading{Boolean} -trueif video playback is loading.paused{Boolean} - Playing vs paused state.truemeans the media is pausedplaybackRate{Number} - Current playback rate, as a numberproportionLoaded{Number} - A value between0and1representing the proportion of the media that has loadedproportionPlayed{Number} - A value between0and1representing the proportion of the media that has already been shown
Events:
onLoadStart- Called when the video starts to loadonPlay- Sent when playback of the media starts after having been pausedonUpdate- Sent when any of the properties were updated
Methods:
play()- play videopause()- pause videoload()- load video
The limestone/VideoPlayerlimestone/VideoPlayer.Video.source property is passed to the video component as a child node.
Default: 'video'preloadSource
Section titled “preloadSource”The video source to be preloaded. Expects a <source> node.
The video source to be played.
Any children <source> elements will be sent directly to the mediaComponent as video
sources.
See: https://developerhttps://developer.mozilla.org/en-US/docs/Web/HTML/Element/source
VideoPlayerBase Component
Section titled “VideoPlayerBase   Component ”A player for video limestone/VideoPlayerlimestone/VideoPlayer.VideoPlayerBase.
Properties
autoCloseTimeout
Section titled “autoCloseTimeout”The time (in milliseconds) before the control buttons will hide.
Setting this to 0 or null disables closing, requiring user input to open and close.
backButtonAriaLabel
Section titled “backButtonAriaLabel”Sets the hint string read when focusing the back button.
Default: 'go to previous'disabled
Section titled “disabled”Removes interactive capability from this component. This includes, but is not limited to, key-press events, most clickable buttons, and prevents the showing of the controls.
feedbackHideDelay
Section titled “feedbackHideDelay”Amount of time (in milliseconds) after which the feedback text/icon part of the slider's
tooltip will automatically hidden after the last action.
Setting this to 0 or null disables feedbackHideDelay; feedback will always be present.
includeTimeHour
Section titled “includeTimeHour”Checks if current time and total time should include the hour.
Default: falseinfoComponents
Section titled “infoComponents”Components placed below the title.
Typically, these will be media descriptor icons, like how many audio channels, what codec the video uses, but can also be a description for the video or anything else that seems appropriate to provide information about the video to the user.
initialJumpDelay
Section titled “initialJumpDelay”The number of milliseconds that the player will pause before firing the first jump event on a right or left pulse.
Default: 400jumpBy
Section titled “jumpBy”The number of seconds the player should skip forward or backward when a "jump" button is pressed.
Default: 30jumpDelay
Section titled “jumpDelay”The number of milliseconds that the player will throttle before firing a jump event on a right or left pulse.
Default: 200loading
Section titled “loading”Manually set the loading state of the media, in case you have information that
VideoPlayer does not have.
locale
Section titled “locale”The current locale as a https://toolshttps://tools.ietf.org/html/rfc5646.
Overrides the default media control component to support customized behaviors.
The provided component will receive the following props from VideoPlayer:
initialJumpDelay- Time (in ms) to wait before starting a jumpjumpDelay- - Time (in ms) to wait between jumpsmediaDisabled-truewhen the media controls are not interactiveno5WayJump-truewhen 5-way jumping is disabledonClose- Called when cancel key is pressed when the media controls are visibleonFastForward- Called when the media is fast forwarded via a key eventonJump- Called when the media jumps either forward or backwardonJumpBackwardButtonClick- Called when the jump backward button is pressedonJumpForwardButtonClick- Called when the jump forward button is pressedonKeyDown- Called when a key is pressedonNextButtonClick- Called when the next button is pressedonPause- Called when the media is paused via a key eventonPlay- Called when the media is played via a key eventonPreviousButtonClick- Called when the previous button is pressedonRewind- Called when the media is rewound via a key eventonToggleMore- Called when the more components are hidden or shownpaused-truewhen the media is pausedspotlightId- The spotlight container Id for the media controlsspotlightDisabled-truewhen spotlight is disabled for the media controlsvisible-truewhen the media controls should be displayed
miniFeedbackHideDelay
Section titled “miniFeedbackHideDelay”Amount of time (in milliseconds), after the last user action, that the miniFeedback
will automatically hide.
Setting this to 0 or null disables miniFeedbackHideDelay; miniFeedback will always
be present.
Disable audio for this video.
In a TV context, this is handled by the remote control, not programmatically in the VideoPlayer API.
Default: falseno5WayJump
Section titled “no5WayJump”Prevents the default behavior of using left and right keys for seeking.
noAutoPlay
Section titled “noAutoPlay”Prevents the default behavior of playing a video immediately after it's loaded.
Default: falsenoAutoShowMediaControls
Section titled “noAutoShowMediaControls”Prevents the default behavior of showing media controls immediately after it's loaded.
Default: falsenoMediaSliderFeedback
Section titled “noMediaSliderFeedback”Hides media slider feedback when fast-forward or rewind while media controls are hidden.
Default: falsenoMiniFeedback
Section titled “noMiniFeedback”Removes the mini feedback.
Default: falsenoSlider
Section titled “noSlider”Removes the media slider.
Default: falsenoSpinner
Section titled “noSpinner”Removes spinner while loading.
onBack
Section titled “onBack”Called when the back button is clicked.
onControlsAvailable
Section titled “onControlsAvailable”Called when the player's controls change availability, whether they are shown or hidden.
The current status is sent as the first argument in an object with a key available
which will be either true or false. (e.g.: onControlsAvailable({available: true}))
onFastForward
Section titled “onFastForward”Called when the video has been fast forwarded.
onJumpBackward
Section titled “onJumpBackward”Called when the user clicks the JumpBackward button.
Is passed a limestone/VideoPlayerlimestone/VideoPlayer.videoStatus as the first argument.
onJumpForward
Section titled “onJumpForward”Called when the user clicks the JumpForward button.
Is passed a limestone/VideoPlayerlimestone/VideoPlayer.videoStatus as the first argument.
onNext
Section titled “onNext”Called when the user clicks the next button.
Is passed a limestone/VideoPlayerlimestone/VideoPlayer.videoStatus as the first argument.
onPause
Section titled “onPause”Called when the video has been paused.
onPlay
Section titled “onPlay”Called when the video has been played.
onPrevious
Section titled “onPrevious”Called when the user clicks the previous button.
Is passed a limestone/VideoPlayerlimestone/VideoPlayer.videoStatus as the first argument.
onRewind
Section titled “onRewind”Called when the video has been rewound.
onScrub
Section titled “onScrub”Called when the user is moving the VideoPlayer's Slider knob independently of the current playback position.
It is passed an object with a seconds key (float value) to indicate the current time
index. It can be used to update the thumbnailSrc to reflect the current scrub
position.
onSeekFailed
Section titled “onSeekFailed”Called when seek is attempted while seekDisabled is true.
onSeekOutsideSelection
Section titled “onSeekOutsideSelection”Called when seeking outside of the current selection range.
By default, the seek will still be performed. Calling preventDefault() on the event
will prevent the seek operation.
onToggleMore
Section titled “onToggleMore”Called when the visibility of more components is changed
Event payload includes:
type- Type of event,'onToggleMore'showMoreComponents-truewhen the components are visible`liftDistance- The distance, in pixels, the component animates `
onWillFastForward
Section titled “onWillFastForward”Called once before the video is forwarded.
onWillJumpBackward
Section titled “onWillJumpBackward”Called once before the video is jump backwarded.
Is passed a limestone/VideoPlayerlimestone/VideoPlayer.videoStatus as the first argument.
onWillJumpForward
Section titled “onWillJumpForward”Called once before the video is jump forwarded.
Is passed a limestone/VideoPlayerlimestone/VideoPlayer.videoStatus as the first argument.
onWillNext
Section titled “onWillNext”Called once before playing the next video in the playlist.
Is passed a limestone/VideoPlayerlimestone/VideoPlayer.videoStatus as the first argument.
onWillPause
Section titled “onWillPause”Called once before the video is paused.
onWillPlay
Section titled “onWillPlay”Called once before the video is played
onWillPrevious
Section titled “onWillPrevious”Called once before playing the previous video in the playlist.
Is passed a limestone/VideoPlayerlimestone/VideoPlayer.videoStatus as the first argument.
onWillRewind
Section titled “onWillRewind”Called once before the video is rewound.
pauseAtEnd
Section titled “pauseAtEnd”Pauses the video when it reaches either the start or the end of the video during rewind, slow rewind, fast-forward, or slow forward.
Default: falseplaybackRateHash
Section titled “playbackRateHash”Mapping of playback rate names to playback rate values that may be set.
Default: { fastForward: ['2', '4', '8', '16'], rewind: ['-2', '-4', '-8', '-16'], slowForward: ['1/4', '1/2'], slowRewind: ['-1/2', '-1'] }seekDisabled
Section titled “seekDisabled”Disables seek function.
Note that jump by arrow keys will also be disabled when true.
selection
Section titled “selection”A range of the video to display as selected.
The value of selection may either be:
nullorundefinedfor no selection,a single-element array with the start time of the selection
a two-element array containing both the start and end time of the selection in seconds
When the start time is specified, the media slider will show filled starting at that time to the current time.
When the end time is specified, the slider's background will be filled between the two times.
source
Section titled “source”The video source.
Any children <source> tag elements of limestone/VideoPlayerlimestone/VideoPlayer will
be sent directly to the videoComponent as video sources.
spotlightDisabled
Section titled “spotlightDisabled”Disables spotlight navigation into the component.
spotlightId
Section titled “spotlightId”The spotlight container ID for the player.
Default: 'videoPlayer'The thumbnail component to be used instead of the built-in version.
The internal thumbnail style will not be applied to this component. This component follows the same rules as the built-in version.
Thumbnail image source to show on the slider knob.
This is a standard limestone/Imagelimestone/Image component so it supports all the same
options for the src property. If no thumbnailComponent and no thumbnailSrc is set,
no tooltip will display.
thumbnailUnavailable
Section titled “thumbnailUnavailable”Enables the thumbnail transition from opaque to translucent.
Title for the video being played.
titleHideDelay
Section titled “titleHideDelay”The time (in milliseconds) before the title disappears from the controls.
Setting this to 0 disables hiding.
Video component to use.
The default renders an HTMLVideoElement. Custom video components must have a similar
API structure, exposing the following APIs:
Properties:
currentTime{Number} - Playback index of the media in secondsduration{Number} - Media's entire duration in secondserror{Boolean} -trueif video playback has errored.loading{Boolean} -trueif video playback is loading.paused{Boolean} - Playing vs paused state.truemeans the media is pausedplaybackRate{Number} - Current playback rate, as a numberproportionLoaded{Number} - A value between0and1representing the proportion of the media that has loadedproportionPlayed{Number} - A value between0and1representing the proportion of the media that has already been shown
Events:
onLoadStart- Called when the video starts to loadonUpdate- Sent when any of the properties were updated
Methods:
play()- play videopause()- pause videoload()- load video
The limestone/VideoPlayerlimestone/VideoPlayer.Video.source property is passed to the video component as a child node.
Default: {@link ui/Media.Media}showControls
Section titled “showControls”Shows media controls.
hideControls
Section titled “hideControls”Hides media controls.
toggleControls
Section titled “toggleControls”Toggles the media controls.
getMediaState
Section titled “getMediaState”Returns an object with the current state of the media including currentTime, duration,
paused, playbackRate, proportionLoaded, and proportionPlayed.
Programmatically plays the current media. If you call this function during fast forwarding or rewinding, the playback speed will be set to normal.
Programmatically pauses the current media. If you call this function during fast forwarding or rewinding, the playback speed will be set to normal.
Sets the media playback time index.
Step a given amount of time away from the current playback position. Like limestone/VideoPlayerlimestone/VideoPlayer.VideoPlayerBase.seek but relative.
fastForward
Section titled “fastForward”Fast forwards the current media for seeking.
This function changes the playback rate.
If you call play or pause during fast forwarding, the playback speed will be set to normal.
rewind
Section titled “rewind”Rewinds the current media for seeking.
This function changes the playback rate.
If you call play or pause during rewinding, the playback speed will be set to normal.
setPlaybackSpeed
Section titled “setPlaybackSpeed”Sets the playback speed.
getVideoNode
Section titled “getVideoNode”Returns a proxy to the underlying <video> node currently used by the VideoPlayer
Type Definitions
Section titled “Type Definitions ”playbackRateHash Object
Section titled “playbackRateHash   Object ”A set of playback rates when media fast forwards, rewinds, slow-forwards, or slow-rewinds.
The number used for each operation is proportional to the normal playing speed, 1. If the rate is less than 1, it will play slower than normal speed, and, if it is larger than 1, it will play faster. If it is negative, it will play backward.
The order of numbers represents the incremental order of rates that will be used for each
operation. Note that rates can be expressed as decimals, strings, and fractions.
(e.g.: 0.5, '0.5', '1/2').
An array of playback rates when media fast forwards
An array of playback rates when media rewinds
An array of playback rates when media slow-forwards
An array of playback rates when media slow-rewinds
videoStatus Object
Section titled “videoStatus   Object ”Every callback sent by limestone/VideoPlayerlimestone/VideoPlayer receives a status package, which includes an object with the following key/value pairs as the first argument:
Type of event that triggered this callback
Playback index of the media in seconds
Media's entire duration in seconds
Playing vs paused state. true means the media is paused
Current playback rate, as a number
A value between 0 and 1 representing the proportion of the media that has loaded
A value between 0 and 1 representing the proportion of the media that has already been shown