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)
embed_video() provides a standard way to embed video in R Markdown documents when the output format is HTML, and to print placeholder text when the output format is not HTML.
You can insert an R code chunk either using the RStudio toolbar (the Insert button) or the keyboard shortcut Ctrl + Alt + I ( Cmd + Option + I on macOS).
To add an image in markdown you must stop text editing, and you do this with the command [Alt text] precedeed by a ! Then you have to add the path to the image in brackets. The path to the image is the path from your directory to the image.
To put it simply - R is the actual programming language, RStudio is a convenient interface in which to use it, and R Markdown is a specific type of file format designed to produce documents that include both code and text.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With