add video to shiny app

3,983 views
Skip to first unread message

Jerônimo Guasselli

unread,
Jan 10, 2015, 11:41:34 PM1/10/15
to shiny-...@googlegroups.com
Can someone sujest me some code to add video to main panel, i tried iframe and video HTML tags, but it did not work well. I want to add a video tutorial about the app in the about tab.

Vincent

unread,
Jan 12, 2015, 3:09:17 AM1/12/15
to shiny-...@googlegroups.com
Try an iframe:

<iframe width="640" height="375" src="//www.youtube.com/embed/e02LFmNysoM" frameborder="0" allowfullscreen></iframe>

I have this in an Rmd file that is rendered in an app

Stéphane Laurent

unread,
Jan 14, 2015, 11:32:38 AM1/14/15
to shiny-...@googlegroups.com

Jerônimo Guasselli

unread,
Jan 15, 2015, 7:31:31 PM1/15/15
to shiny-...@googlegroups.com
Hello, both examples are great, but I used this example.

tabPanel("About", mainPanel(tags$video(src = "www.mp4", type = "video/mp4", autoplay = NA, controls = NA)))

However I just want to play when te user goes to the "About" tab, but when I start the app the video automaticaly starts.

How can I add some play button?

Joe Cheng

unread,
Jan 16, 2015, 12:17:33 AM1/16/15
to Jerônimo Guasselli, shiny-...@googlegroups.com
You could try this in ui.R:

tabPanel("About", mainPanel(uiOutput("video")))

and this in server.R:

output$video <- renderUI({
  tags$video(src = "www.mp4", type = "video/mp4", autoplay = NA, controls = NA)
})

Since the uiOutput("video") starts out hidden, Shiny won't send the video tag to the client until that tab is activated. I think. :)

--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/shiny-discuss/4dced2c2-672e-49f8-8e9d-0630ee28cc52%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Jerônimo Guasselli

unread,
Jan 16, 2015, 8:44:37 PM1/16/15
to shiny-...@googlegroups.com, jegua...@gmail.com
Worked just fine, thank you very much.

Jerônimo Guasselli

unread,
Feb 8, 2015, 8:16:21 AM2/8/15
to shiny-...@googlegroups.com, jegua...@gmail.com
Hi, I just want to know, is there any kind of mp4 that does not play on this function?
Because there is some videos that I cant make it play, because I made a tutorial as mp4, but it is not working, and with some other videos I used as an example to know if was working, it works just fine.


Em sexta-feira, 16 de janeiro de 2015 03:17:33 UTC-2, Joe Cheng [RStudio] escreveu:

Jerônimo Guasselli

unread,
Feb 8, 2015, 12:36:42 PM2/8/15
to shiny-...@googlegroups.com
I just figured out, thanks.

Ramtin Azimi

unread,
Mar 1, 2016, 8:58:45 AM3/1/16
to Shiny - Web Framework for R
Hey Jeronimo, can you let me know what was the problem that some of the mp4-videos played and some didn't. How did you solve the issue?
Reply all
Reply to author
Forward
0 new messages