【发布时间】:2021-05-26 00:37:48
【问题描述】:
我在下面有一个闪亮的仪表板,其中包括一个 actionButton()。当按下它时,会出现一个带有另一个 actionButton() 的模式对话框。当我按下它时,我希望可以从here 下载并保存在名为www 的子目录中的视频在模态中显示和播放。我也对 youtube 视频持开放态度,但它应该在按下按钮后显示。
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(titleWidth = 0
# Set height of dashboardHeader
),
dashboardSidebar(),
dashboardBody(
tags$div(style="display:inline-block",title="Using the range slider",actionButton("info","",icon = icon("info-circle"),style='padding:10px; font-size:80%')),
)
)
server <- function(input, output) {
observeEvent(input$info,{
showModal(modalDialog(
title = span(h3(strong("Distribution of cumulative reported cases (logarithmic scale)"), style = 'font-size:16px;color:#6cbabf;')),
tags$div(style="display:inline-block",title="Using the range slider",actionButton("play","",icon = icon("play"),style='padding:10px; font-size:80%')),
#tags$video(id="video2", type = "mov",src = "Screen Recording 2021-05-25 at 4.03.51 AM.mov", controls = "controls")
#or youtube file
HTML('<iframe width="200" height="100" src="//www.youtube.com/embed/dQw4w9WgXcQ" frameborder="0" allowfullscreen></iframe>') )
))
})
}
shinyApp(ui, server)
【问题讨论】:
标签: r shiny shinydashboard