hakimel / reveal.js

The HTML Presentation Framework
https://revealjs.com
MIT License
67.57k stars 16.62k forks source link

Volume of background video #2344

Open kendzioc opened 5 years ago

kendzioc commented 5 years ago

It would be nice to have control of the background video, at least for it's volume. I tried something like

document.getElementById('mySlideIWantToChange').dataset.backgroundVideo.volume=0.5;

but it didn't work. Does anyone have a clue how to address the background video?

zinefer commented 1 month ago

This worked for me:

Reveal.on('fragmentshown', (event) => {
  document.querySelectorAll("audio[data-volume]").forEach((audio) => {
    audio.volume = audio.getAttribute("data-volume");
  });
});