S Das
S Das

Reputation: 3391

Embed Youtube Video in R Markdown

I am trying to publish a .Rmd in Rpubs by embedding a YouTube video link. After some exploration, I am trying the following which just gives a blank space in my html.

<div align="center">
   <iframe width="560" height="315" src="http://www.youtube.com/embed/zsYjsgm4Psg" frameborder="0" allowfullscreen>
   </iframe>
</div>

Two related posts:

  1. rmarkdown: Alter Action Depending on Document
  2. R markdown Embedded Youtube Video

Upvotes: 12

Views: 8913

Answers (2)

Mike Seman
Mike Seman

Reputation: 66

On you tube, I tried using the link for sharing, https://youtu.be/....

But instead find "embed" under where you tube gives the share link. This give the tag you need and the right link, it is not the same has you would use in an tag.

Upvotes: 1

Hack-R
Hack-R

Reputation: 23214

<iframe width="560" height="315" src="http://www.youtube.com/embed/9bZkp7q19f0?rel=0" frameborder="0" allowfullscreen></iframe>

This can optionally be put inside a code chunk within your .Rmd

Source

Upvotes: 14

Related Questions