tubeplay <- function(url = "https://www.youtube.com/watch?v=iOFZKwv_LfA",
width = "560", height = "315", background = "white",
viewer = getOption("viewer", utils::browseURL)) {
# make video_id
video_id <- gsub("^.*\\?v=", "", url)
# make_ui
ui <- miniUI::miniPage(
htmltools::tags$iframe(width = width, height = height,
src = paste("https://www.youtube.com/embed", video_id, sep = "/"),
frameborder="0")
)
htmltools::html_print(ui)
}
kazutan/tubeplayR
パッケージ
?htmltools::html_print
を参照
tubeplay()
を実行して動くかどうかテストdevtools::install_github("kazutan/tubeplayR")
library("tubeplayR")
tubeplay()