Skip to content

Playlists and other video support functions from volleyball match files.

License

Notifications You must be signed in to change notification settings

openvolley/ovideo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ovideo

Lifecycle: maturing openvolley R-CMD-check

Installation

install.packages("ovideo", repos = c("https://openvolley.r-universe.dev",
                                    "https://cloud.r-project.org"))

## or

## install.packages("remotes") ## if needed
remotes::install_github("openvolley/ovideo")

Example usage

Create a standalone HTML file that plays a video playlist.

Start by loading our scout file, which is bundled with the ovdata package.

library(ovdata) ## install via install.packages("ovdata", repos = c("https://openvolley.r-universe.dev", "https://cloud.r-project.org"))
library(ovideo)
x <- ovdata_example("190301_kats_beds-clip", as = "parsed")

We need to make sure that the video metadata element points somewhere meaningful. We can either use a local video file as the source:

dv_meta_video(x) <- ovdata_example_video("190301_kats_beds")

But if we use a local video file, we can’t share the resulting HTML file with anyone else. Instead we can use an online video URL, in this case on YouTube:

dv_meta_video(x) <- "https://youtu.be/4YH89aSlc6M"

And now on with the rest of the process:

## 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!
browseURL(f)

And you should see something like:

About

Playlists and other video support functions from volleyball match files.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages