video | R Documentation |
A video player that can be embedded in HTML pages.
video( files, format = NULL, options = list(), seek_ping_rate = 1000, width = NULL, height = NULL, elementId = NULL )
files |
A vector of file paths or URLs pointing |
format |
An optional list of formats of |
options |
A named list of options to apply to the video. List of available options available in Details |
seek_ping_rate |
Number of milliseconds between each update of 'input${id}_seek' while playing. Default is set to 1000. If set to 0, then 'input${id}_seek' will not exist. |
width, height |
Must be a valid CSS unit (like |
elementId |
HTML id tag to be given to the video player element |
Here are some more common options to implement:
Whether or not the video will autoplay on load. NOTE: There is not a guarantee autoplay will work in the browser.
FALSE
Default: Video won't autoplay
TRUE
Video will use browser's autoplay
"muted"
Will mute the video and then manually call play()
on loadstart()
. Likely to work on browsers
"play"
Will call play()
on loadstart()
, similar to browser autoplay
Determines whether or not the player has controls that the user can interact with. By default
video
will include controls even if not specified in the options.
A URL to an image that displays before the video begins playing. This is often a frame of the video or a custom title screen.
For a full list of available options check out https://videojs.com/guides/options/
A shiny.tag containing all of the required options for a videojs
JS object to be initialised in a shiny application.
On the server side there will be up to four additional objects available as inputs:
{id}_playing
A logical value as to whether or not the video
is playing audio
{id}_seek
(If seek_ping_rate > 0
) the current time of the track loaded
{id}_duration
The duration of the track loaded
if (interactive()) { library(shiny) ui <- fluidPage( title = "howler.js Player", video("https://vjs.zencdn.net/v/oceans.mp4") ) server <- function(input, output) { } runShiny(ui, server) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.