Create video playlist
Usage
ov_video_playlist(
x,
meta,
type = NULL,
timing = ov_video_timing(),
extra_cols = NULL,
normalize_paths = TRUE
)
Arguments
- x
data.frame: a datavolleyplays object. Normally this will be a selected subset of the
plays
component of a datavolley object (i.e. a selected set of actions that you want the video playlist to contain)- meta
list: either the
meta
component of a datavolley object, or a list of such objects, or a data.frame with the columns "match_id" and "video_src". Entries invideo_src
should be paths or URLs to the video file associated with the correspondingmatch_id
- type
string: currently "youtube", "twitch", or "local". If
type
is not specified as a parameter, andmeta
is a data.frame, thentype
can be provided as a column inmeta
. Alternatively, ifmeta
is ameta
component of a datavolley object, or a list of such objects, thentype
will be assumed to be "local". Note that a single playlist can't mix types, all entries must be of the same type- timing
list: the relative timing for each skill type, either a named list as returned by
ov_video_timing()
or a data.frame as returned byov_video_timing_df()
. Seeov_video_timing()
for further details- extra_cols
character: names of additional columns from
x
to include in the returned data frame- normalize_paths
logical: if
TRUE
, applynormalizePath
to local file paths. This will e.g. expand the tilde in paths like "~/path/to/video.mp4"
Examples
## read data file
x <- datavolley::dv_read(datavolley::dv_example_file())
## note that this data file has no video specified, so put a dummy value in
dv_meta_video(x) <- "c:\\my_video.mp4"
## extract play-by-play data
px <- datavolley::plays(x)
## and put dummy video_time values in, because those are missing too
px$video_time <- sample.int(2e3, size = nrow(px))
## find pipe (XP) attacks in transition
px <- px[which(px$attack_code == "XP" & px$phase == "Transition"), ]
## create playlist
ply <- ov_video_playlist(px, x$meta, timing = ov_video_timing())
## with custom timing
ply <- ov_video_playlist(px, x$meta,
timing = ov_video_timing_df(data.frame(skill = "Attack", phase = "Transition",
start_offset = -5, duration = 10, stringsAsFactors = FALSE)))