MSzturc / obsidian-advanced-slides

Create markdown-based reveal.js presentations in Obsidian
https://mszturc.github.io/obsidian-advanced-slides/
MIT License
939 stars 80 forks source link

Copy videos at export time and support videos using obsidian syntax #261

Open marcbenedi opened 9 months ago

marcbenedi commented 9 months ago

Hi,

I had been experiencing this issue for a while aswell #260 .

This PR adds support to videos included with obsidian syntax (which were not rendered before)

![[myVideo.mp4]]

And copies the video file when exporting the slides. It also copies the file if it is embedded using html code. For example:

<video data-autoplay="" controls="" loop="" height="700" data-paused-by-reveal="">
  <source src="/99-Attachments/2023-09-12_jumping_jacks.mp4" type="video/mp4">
</video>
jericjan commented 9 months ago

![[myVideo.mp4]] seems to default with loop enabled. is it possible to implement some way to disable it without using the video HTML tag? Maybe something like ![[myVideo.mp4|noloop]]

marcbenedi commented 9 months ago

![[myVideo.mp4]] seems to default with loop enabled. is it possible to implement some way to disable it without using the video HTML tag? Maybe something like ![[myVideo.mp4|noloop]]

Hey @jericjan, good catch!

I hardcoded some attributes which should not be there. I updated the PR. Now the generated html only contains the following:

<video> <source src="example.mp4" alt="" type="video/mp4"></video>

To modify it, we can use the same "element annotation" feature used in images or others: https://mszturc.github.io/obsidian-advanced-slides/extend-syntax/classes/

For example:

![[example.mp4]] <!-- element data-autoplay -->

Generates

<video data-autoplay="true"> <source src="example.mp4" alt="" type="video/mp4"></video>