Last active
February 1, 2024 13:55
-
-
Save schochastics/5c5b2d153625c7e2e8bcf3ea7e874c3a to your computer and use it in GitHub Desktop.
Play youtube videos in Rstudio viewer pane
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(shiny) | |
xy <- c(784,479) #output of grDevices::dev.size("px") | |
url <- "https://www.youtube.com/watch?v=Ef2jmf2vy00" #copy yt link here | |
url <- gsub("watch\\?v=","embed/",url) | |
ui <- fluidPage( | |
HTML(paste0('<iframe width="',xy[1],'" height="',xy[2],'" src="',url,'" frameborder="0"></iframe>')) | |
) | |
server <- function(input, output, session) { | |
} | |
runGadget(shinyApp(ui, server,options=c("launch.browser"=FALSE,"port"=1111)),port=1111,viewer = paneViewer()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
rstudioapi::viewer("http://127.0.0.1:1111")
in the R console