How to embed local Video in R Markdown?

Harmanjit Singh picture Harmanjit Singh · May 8, 2017 · Viewed 9.8k times · Source

I already know how to embed the youtube video in the R Markdown document. But Suppose I have offline video, that I do not want to publish, in mp4 or avi format. Is there a way to embed it in the document? Something like the following (taking inspiration from image embedding):

![Caption](vid/video1.mp4)

Answer

Mat D. picture Mat D. · May 17, 2018

This worked for me:

Slide With Code
========================================================
<video width="320" height="240" controls>
  <source src="movie.mp4" type="video/mp4">
</video>

If you remove the width and height, and enable

autosize: true

R takes care of the size of the video.