grimbough / msmbstyle

Tufte inspired bookdown template
https://www-huber.embl.de/users/msmith/msmbstyle/
59 stars 17 forks source link

Inserting URL to a video #17

Closed aridus closed 5 years ago

aridus commented 5 years ago

I would like to include links to some instructional videos on my youtube panel. The only way I have found to do it is with the vembedr package, viz:

vembedr::embed_youtube(rep("_FeR6EFXnck"))

Although this works, it does not allow resizing, placing in the margin, or other modifications, and one cannot use a figure label. In the absence of any alternative, this at least works. This is what I would like to be able to do:

knitr::include_url("https://www.youtube.com/embed/9bZkp7q19f0")

(see https://github.com/rstudio/bookdown/issues/92) but it doesn't do anything.

Do you have any ideas?

With grateful thanks.

grimbough commented 5 years ago

This sounds similar to #11 knitr::include_url() seems a bit tempramental. Are you able to embed a webpage if you try the example there? Seems to be 50/50 at the moment.

aridus commented 5 years ago

Thank you. This (from the example)

knitr::include_url('https://msmith.de')

works fine. But this

knitr::include_url('https://youtu.be/_FeR6EFXnck')

does not.

grimbough commented 5 years ago

If I use the embed URL the video shows up for me e.g.

```{r embed2, out.extra='style="border: none;"', out.width='99%', fig.cap="Embedded YouTube video", echo = FALSE}
knitr::include_url('https://youtube.com/embed/_FeR6EFXnck')

Gives me : 

![image](https://user-images.githubusercontent.com/971237/57570457-713b9e80-7402-11e9-9276-ec7019747fc5.png)

I'll have a look at getting this in the margin, but there's a fair chance its an issue in **bookdown** or **tufte** as it seems to disappear completely if I use a `marginfigure` block and do nothing if using `fig.margin = TRUE`
aridus commented 5 years ago

Thank you! I would never have figured this out on my own!

This works well for me, and I have now managed to embed six video tutorials successfullyt.

Nearly there....

grimbough commented 5 years ago

No problem. There's so many packages in play here that it's really hard to find the appropriate documentation, if it even exists.