ov_playlist_to_html: Convert playlist to standalone HTML file

View source: R/playlists.R

ov_playlist_to_htmlR Documentation

Convert playlist to standalone HTML file

Description

Converts a playlist object to an HTML file that can be opened in any browser. Note that if the playlist uses local video files, the HTML file will only work on a device that has access to those files. If the playlist uses YouTube (or other external) video URLs, the HTML file will be usable on any network-connected device.

Usage

ov_playlist_to_html(
  playlist,
  playlist_name = "Playlist",
  outfile,
  no_paths = FALSE,
  table_cols = c(),
  loop = FALSE,
  ...
)

Arguments

playlist

data.frame: as returned by ov_video_playlist(). If the playlist contains one or both of the columns subtitle or subtitleskill, these will be shown as subtitle information that changes as each clip is played

playlist_name

string: the name to use for the playlist

outfile

string: the file name to write to. If not supplied, a file will be created in the temporary directory. Note that the directory of outfile must already exist

no_paths

logical: if TRUE, remove the paths from video files (only applicable to local files, not YouTube or other external URLs). If no_paths is TRUE, The HTML file must be saved into the same directory as the video source file(s)

table_cols

character: the names of columns in playlist to show in the plays table in the HTML file. If table_cols is empty, or contains no column names that are present in playlist, then no table will be shown

loop

logical: should we loop endlessly over the playlist?

...

: additional arguments passed to the Rmd file used to generate the HTML. Currently these are:

  • css : a string with additional css to apply to the file

  • ui_header : a tag element to replace the default page header

Value

The path to the HTML file

See Also

ov_video_playlist() ov_playlist_to_vlc()

Examples

## Not run: 
  ## use data from the ovdata package
  library(ovdata) ## install via remotes::install_github("openvolley/ovdata") if needed
  x <- ovdata_example("190301_kats_beds-clip", as = "parsed")

  ## make sure its video element points to our local copy of the corresponding video clip
  dv_meta_video(x) <- ovdata_example_video("190301_kats_beds")

  ## extract the plays
  px <- datavolley::plays(x)
  ## it's a single rally, so we'll use all rows (just exclude NA skill rows)
  px <- px[!is.na(px$skill), ]

  ## define columns to show in the table
  extra_cols <- c("home_team", "visiting_team", "video_time", "code", "set_number",
                  "home_team_score", "visiting_team_score")

  ## make the playlist with extra columns included
  ply <- ov_video_playlist(px, x$meta, extra_cols = c(extra_cols, "player_name"))

  ## use player name as the subtitle
  ply$subtitle <- ply$player_name

  ## convert to HTML
  f <- ov_playlist_to_html(ply, table_cols = extra_cols)

  ## and finally open it!
  browseFile(f)

## End(Not run)


openvolley/ovideo documentation built on March 19, 2024, 9:52 p.m.