I want to play an mp4 video in a shiny output. It plays fine on my computer when I double click on the file name. I copied the file to the www folder below the main app folder. I have tried variations on the following code.
library(shiny)
library(shinyjs)
ui <- fluidPage(
useShinyjs(debug = TRUE),
mainPanel(
"video test",
uiOutput('ozoneVideo'), id = "mainPanel")
)
server <- function(input, output, session) {
output$ozoneVideo <- renderUI({
h6("ozone video", tags$video(src = "MesaCountyOzone2017_07_10.mp4", type = "video/mp4", width = "1080px", height = "480px", controls = "controls", autoplay = NA))
})
}
shinyApp(ui = ui, server = server)
The web page that is generated shows the text elements (video test, ozone video) and horizontal bar with a video play button and the word "Error" with no explanation. No error appears in the javascript console.
When I add www/ to the filename, the javascript console has an error message "Failed to load resource: the server responded with a status of 404 (Not Found) and a url of http://127.0.0.1:4817/www/MesaCountyOzone2017_07_10.mp4
Any help clarifying this greatly appreciated!
Update: July 11, 2017. I am now pretty sure this is a problem with Safari. I run the app with run external chosen. The web page that opens up in Safari has an error message in the video control section. If I copy the url and past to a Chrome web page, the video plays fine.
So my question is now what do I do to make this play in Safari???