The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
{video}
is a package that utilises the video.js library to play
video on the modern web.
This package is not yet available on CRAN. To install the latest version:
install.packages("devtools")
::install_github("ashbaldry/video") devtools
The HTML way to include an audio file in any shiny application/web
page is to use the <audio>
tag. This cannot (easily)
be manipulated from the server.
$video(src = "https://vjs.zencdn.net/v/oceans.mp4", type = "video/mp4", controls = NA) tags
video.js is a flexible video player that is more robust than the basic HTML5 video player, and can easily be manipulated from the server side of shiny applications.
library(shiny)
library(video)
<- fluidPage(
ui title = "video Example",
h1("Video Example"),
video(
"https://vjs.zencdn.net/v/oceans.mp4",
elementId = "video"
),$p(
tags"Currently playing:",
textOutput("video_playing", container = tags$strong, inline = TRUE)
)
)
<- function(input, output, session) {
server $video_playing <- renderText({
outputif (isTRUE(input$video_playing)) "Yes" else "No"
})
observe({
req(input$video_seek)
if (round(input$video_seek) == 10) {
pauseVideo("video")
else if (round(input$video_seek) == 20) {
} stopVideo("video")
}
})
}
shinyApp(ui, server)
Whilst the buttons below the video aren’t required for
playing/pausing the video, they are linked to observeEvent
s
that send messages from the server to the video to update.
For those who want more from video.js and isn’t currently available
within {video}, then the API is very flexible (https://docs.videojs.com/), and any video can be
retrieved in JavaScript using const player = videojs("id")
and manipulated from there.
All examples are available in the Examples
directory and can be run locally by installing the {video}
package:
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.