1
我想通過點擊動作按鈕的一些Youtube嵌入式鏈接,但無法做到這一點,我已經嘗試了下面附加的一些代碼,我嘗試從服務器傳遞鏈接到UI,可有一個人幫我找到以下問題的解決方案:R閃亮 - 傳遞Youtube鏈接到iframe
這裏有一些假的碼:
ui.r
library(shiny)
library(shinyLP)
shinyUI(fluidPage(
titlePanel("Title"),
sidebarLayout(
sidebarPanel(
actionButton("analyse1","Link 1"),
actionButton("analyse2","Link 2"),
iframe(width = "250", height = "150",url_link =s5)), #s5 in server.r are reactive youtube links
mainPanel(
textOuput("textOut")
))
))
server.r
shinyServer(
function(input,output,session){
terms1<-reactiveValues(dta = NULL)
observeEvent(input$analyse1,{withProgress({
setProgress(message = "Please Wait...")
terms1$dta<-"Video 1"
s5<-"https://www.youtube.com/embed/XQTAD9P5A1U"})})
observeEvent(input$analyse2,{withProgress({
setProgress(message = "Please Wait...")
terms1$dta<-"Video 2"
s5<-"https://www.youtube.com/embed/em1u7iO9D1k"})})
output$textOut<-renderText({
(terms1$dta)
})
}
)
感謝@NBATrends完美的,我會在我的代碼包含這些。 –