knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
This article deals with modifications you can make to videos that you embed. These include:
These modifications can be made independently of each other, and can be composed:
embed_youtube("2WoDQBhJCVQ") %>% use_start_time("44s") %>% use_align("center") %>% use_rounded(10)
To embed videos from variety of services, please read
To specify a starting time for a video, you can
embed_youtube(id = "8SGif63VW6E") %>% use_start_time("4m12s")
Thanks to Aurélien Ginolhac for suggesting this video using this start-time.
use_start_time() function treats these all of these inputs equivalently:
This function works with all of the services except for Box.
use_align() to specify the horizontal alignment:
embed_vimeo("10022924") %>% use_align("center")
Possible values for
use_rounded() to specify the
radius (in pixels) of the rounds:
embed_youtube("lan-UQfN0zs") %>% use_rounded(radius = 10)
This seems to work better in the browser than in the RStudio viewer.
If you are using Bootstrap, you can
use_bs_responsive() to make your video responsive to the width of its container:
embed_youtube("FkBQc0gQkQI") %>% use_bs_responsive()
It has no arguments, but it uses the
ratio provided to the
embed_youtube("KvX8MijgeW8", ratio = "4by3") %>% use_bs_responsive()
ratio defaults to
"16by9", but it can also be
If you are viewing this as this HTML vignette provided by R's help, you will not see responsiveness as it does not use Bootstrap.
If you are viewing this at this package's pkgdown site, you will see the responsiveness.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.