This article describes how to embed a video into your document.
Requirements
Please note this requires the Data Stories module or a Displayr license.
- A document.
- A link to wherever the video is hosted. The video needs to hosted on a video hosting website like YouTube, Wistia, etc that has an actual video player that can play the video. (If you link to a file directly then the file will be downloaded instead of played). For example, if using YouTube, as in the video above go to the video, click Share and then copy the embed code.
Method
- On the page where you want to embed the video, go to Calculation > Custom Code.
- Paste the following code into the R CODE editor, updating the src in line 8 with the address of your video:
text = "<style>.embed-container
{ position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; max-width: 100%; }
.embed-container iframe,
.embed-container object,
.embed-container embed
{ position: absolute; top: 0; left: 0; width: 100%; height: 100%; }</style>
<div class='embed-container'><iframe
src='https://www.youtube.com/embed/QILiHiTD3uc'
frameborder='0' allowfullscreen></iframe></div>"
rhtmlMetro::Box(text = text, text.as.html = TRUE)
Since YouTube videos are not responsive to size, you can change the width and height settings as you need.
Other video platforms, such as Wistia, have advanced embed options, which can be selected and included in the embed code.