HTML5 Video OnComplete Next Slide Reveal.js

我是研究僧i 提交于 2019-12-11 03:23:46

问题


Does anyone know if one can connect a HTML5 Video with the presentation javascript, Reveal.js so that if I play a video on one slide, when that video is complete, it would automatically progress to the next slide?

Reveal.js has it's own eventHandler

Reveal.addEventListener( 'customevent', function() {
    console.log( '"customevent" has fired' );
} );

But I cannot find any specific documentation on if elements inside a slide can trigger the nextSlide functionality.


回答1:


SO... here is the solution, or at least the answer that I came up with.

You have a series of SECTIONS that are acting as the slides, and a video in one of those slides.

in THAT slide, you need to add the following script:

<script>
     var video = document.getElementById("myVideo");
     video.onended = function(e) {
          Reveal.next();
     }
</script>

Make sure you label your video element with an ID tag, and then call that ID tag in this script. The Reveal.next() is part of the built-in API that will automatically progress the slideshow.



来源:https://stackoverflow.com/questions/26617748/html5-video-oncomplete-next-slide-reveal-js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!