#' vidpage UI Function
#'
#' @description A shiny Module.
#'
#' @param id,input,output,session Internal parameters for {shiny}.
#'
#' @noRd
#'
#' @importFrom shiny NS tagList
mod_vidpage_ui <- function(id){
ns <- NS(id)
tagList(
htmlOutput(ns("cnv")),
htmlOutput(ns("otpt")),
div(id = "buttons",
actionButton(ns("ct"), "Crt"),
actionButton(ns("mtch"), "Mtch"),
)
)
}
#' vidpage Server Function
#'
#' @noRd
mod_vidpage_server <- function(input, output, session, stp){
ns <- session$ns
vdp <- reactiveValues()
vdp$mode <- ""
observe({
stpgo <- stp$vidgo
req(stpgo == TRUE)
output$otpt <- renderUI({
runjs("gonow = 1;")
sjs <- paste0("ytb_id = '", stp$url, "';")
print(sjs)
runjs(sjs)
# runjs(paste0("var ytb_id = '", stp$url, "';"))
# print(stp$url)
# runjs("console.log(ytb_id);")
HTML("<div id = 'player'></div><script src='www/youtube.js'></script>")
# HTML("<div></div>")
})
})
observeEvent(input$ct, {
vdp$mode <- "court"
})
observeEvent(input$mtch, {
vdp$mode <- "match"
})
vdp
}
## To be copied in the UI
# mod_vidpage_ui("vidpage_ui_1")
## To be copied in the server
# callModule(mod_vidpage_server, "vidpage_ui_1")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.