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 columnssubtitle
orsubtitleskill
, 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). Ifno_paths
isTRUE
, 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. Iftable_cols
is empty, or contains no column names that are present inplaylist
, 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
Examples
if (FALSE) {
## 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)
}