Skip to content

Instantly share code, notes, and snippets.

@Sciss
Created September 26, 2022 21:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sciss/feba20fc59f36568e06ac2d24f596bfd to your computer and use it in GitHub Desktop.
Save Sciss/feba20fc59f36568e06ac2d24f596bfd to your computer and use it in GitHub Desktop.
var funStartStopMedia = function() {
console.log("play/stop");
var sl = Reveal.getCurrentSlide();
var e = sl.getElementsByTagName("audio")[0];
if (typeof e == 'undefined') {
e = sl.getElementsByTagName("video")[0];
};
if (typeof e !== 'undefined') {
if (e.paused) {
e.play();
e.requestFullscreen(); // doesn't work
} else {
e.pause();
document.exitFullscreen();
}
};
};
Reveal.configure({
keyboard: {
27: funStartStopMedia, // logitech r400: escape
116: funStartStopMedia, // logitech r400: f5
// 190: () => { alert("stop") },
},
transition: 'fade'
});
/*
for this to work, use `about:config` and set
`full-screen-api.allow-trusted-requests-only` to `false`
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment