Solution 1 :

It looks like when you use shinyApp it will not automatically serve files from the www folder. This is likely because you are passing in functions rather than a path to an application folder so it doesn’t assume you want to look in your current directory for files.

Before running shinyApp, you could run

addResourcePath("vid", directoryPath = './www')

and update your path for the video to be

src = "vid/SampleVideo_640x360_1mb.mp4",

This will tell shiny where to look for files with a given URL path prefix.

Problem :

All I get is a solid white background where there should be a video playing. If you click the download link in the shiny app video box, you can download a video that plays as expected in Quicktime.

Link to the source video is here. I placed the video in a www folder where my app.R file lives. I’m on a Mac using Chrome and Safari.

library(shiny)

ui <- fluidPage(

    # Application title
    titlePanel("Video Compatibility"),

    sidebarLayout(
        sidebarPanel(
            "side bar text"
        ),

        mainPanel(
            p("Video Below"),
            tags$video(
                src = "SampleVideo_640x360_1mb.mp4",
                type = "video/mp4",
                autoplay=TRUE,
                muted=TRUE,
                playsinline=TRUE,
                loop=TRUE,
                controls=TRUE),
            p("Video above")

        )
    )
)

server <- function(input, output) {

}

# Run the application 
shinyApp(ui = ui, server = server)

Comments

Comment posted by dca

Thanks, but that didn’t change anything. BTW, same thing happens when this is on shinyapps.io

Comment posted by MrFlick

It worked for me when I tested it. In order to get the

Comment posted by dca

Still no luck. I tried various iterations of your suggestion, but just adding your line didn’t work on my end. I also tried opening the URL in Safari, to see if it was some weird cache in Chrome.

By