dv_playlist_as_onclick: Convert playlist to 'onclick' string

Description Usage Arguments Value Examples

View source: R/playlists.R

Description

Convert playlist to 'onclick' string

Usage

1
2
3
4
5
6
dv_playlist_as_onclick(
  playlist,
  video_id,
  normalize_paths = TRUE,
  dvjs_fun = "dvjs_set_playlist_and_play"
)

Arguments

playlist

data.frame: a playlist as returned by dv_video_playlist

video_id

string: the id of the HTML video element to attach the playlist to

normalize_paths

logical: if TRUE, apply normalizePath to local file paths. This will e.g. expand the tilde in paths like "~/path/to/video.mp4"

dvjs_fun

string: the javascript function to use

Value

A string suitable for inclusion as an 'onclick' tag attribute

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## 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", style = "height: 480px; background-color: black;"),
          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.