Video services

Ian Lyttle


The foundation of this package is the embed() family of functions, used to generate the embed code from a supported service. Often, parameters are specified in the embed code using the query and fragment components of the reference URL. The query/fragment parameters for each service can be found at:

One of the goals of this package is to make it easier to specify the important parameters: video-identifier and (optional) start-time. This vignette deals with how to obtain video-identifiers, the helpers vignette deals with how to set the start-time.

Each of the services exposes height and width arguments; each of the embed() functions has these arguments. The defaults for each service are taken from that service’s default values.

If this package does not contain the customization you need, keep in mind that the the ouput of an embed() function is simply an HMTL tag that can be modified using functions from the htmltools package.


For example, to center your video horizontally, you can wrap your embed function in an htmltools::div():

  align = "center",


You can get your video’s identifier by inspecting its URL at YouTube. Consider this YouTube URL:

The identifier is simply the last part of the URL: 44wDwMQVqCc.

To embed this video, use the function embed_youtube(), using the identifier as the id argument:

embed_youtube(id = "44wDwMQVqCc")


For Vimeo, the identifier is also included in the standard URL:

The Vimeo identifier is just the path part of the URL: 110538136:

embed_vimeo(id = "110538136")

UseR!2016 (and 2017)

One of the great things about the useR! 2016 conference was that all of the keynotes and contributed talks were recorded, thanks to Microsoft. The videos are available on Microsoft’s Channel 9 service - so it behooves us to make an function to embed Channel 9 videos.

Consider Rick Becker’s talk on the history of the S language. Seriously, consider it - now, if you have not already seen it:

For a UseR!2016 (or 2017) video, the identifier is the last component of path of the URL, in this case: Forty-years-of-S. To embed the video:

embed_user2016(id = "Forty-years-of-S")

Channel 9

The UseR! 2016 ans 2017 videos are hosted on Microsoft’s Channel 9 service, so an embed function is provided to use it.

Personal note: one of the things I want to well-and-truly understand (along with non-standard evaluation) is monads. I understand it to be a useful construct for managing side-effects, but true understanding escapes me. This is a great video; it gets me 95% of the way there (I think), so maybe repeated viewings will get me sufficiently close.

Here’s the URL:

The identifier is the path of the URL, Shows/Going+Deep/Brian-Beckman-Dont-fear-the-Monads, which you can express as a string:

embed_channel9(id = "Shows/Going+Deep/Brian-Beckman-Dont-fear-the-Monads")

Alternatively, you can express this as a vector of strings:

  id = c("Shows", "Going+Deep", "Brian-Beckman-Dont-fear-the-Monads")