Reputation: 303
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):

Upvotes: 20
Views: 16246
Reputation: 64
It also works to use an image tag
<img src="movie.mp4" type="video/mp4"/>
Upvotes: 0
Reputation: 28441
Using iframe
worked for me
```{r}
video_path <- "vid/"
video_files <- list.files(video_path,
pattern = "\\.mp4$",
recursive = TRUE,
all.files = FALSE,
full.names = TRUE)
```
<iframe width="720" height="480" src="`r video_files[1]`" align="middle" frameborder="0" allowfullscreen></iframe>
Upvotes: 2
Reputation: 9
See the code
](https://www.youtube.com/watch?v=xyz)
See the code
Upvotes: -2
Reputation: 628
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.
Upvotes: 22