dv_video_player: Video player tag element

Description Usage Arguments Value Examples

View source: R/player.R

Description

Video player tag element

Usage

1
dv_video_player(id, type, controls = FALSE, ...)

Arguments

id

string: the id of the tag

type

string: either "youtube" or "local"

controls

logical: add "previous", "next", "pause", and "stop" buttons. If controls is an object of class shiny.tag (created by htmltools::tags) or shiny.tag.list (htmltools::tagList) then it will be appended to the controls

...

: other attributes of the player element (passed to the player tags$div call for youtube or tags$video for local)

Value

HTML tags. The outermost element is a div with id paste0(id, "_container"), with the player and optionally buttons nested within it.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
## Not run: 
  library(shiny)

  ## hand-crafted playlist for this example
  playlist <- data.frame(video_src = "xL7qEpOdtio",
                         start_time = c(5417, 7252, 6222, 7656, 7369),
                         duration = 8,
                         type = "youtube")
  shinyApp(
      ui = fluidPage(
          dv_video_js(youtube = TRUE),
          dv_video_player(id = "yt_player", type = "youtube", controls = TRUE,
                          style = "height: 480px; background-color: black;"),
          tags$button("Go", onclick = dv_playlist_as_onclick(playlist, "yt_player"))
      ),
      server = function(input, output) {},
  )

  shinyApp(
      ui = fluidPage(
          dv_video_js(youtube = TRUE),
          dv_video_player(id = "yt_player", type = "youtube",
                          style = "height: 480px; background-color: black;",
                          controls = tags$button("Go",
                                       onclick = dv_playlist_as_onclick(playlist, "yt_player")))
      )),
      server = function(input, output) {},
  )

## End(Not run)

scienceuntangled/dvideo documentation built on March 13, 2020, 6:50 p.m.