data-autoslide attribute takes precedence over video duration
parent
b7487b8b4f
commit
b1e5db0ec9
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -31,6 +31,11 @@
|
||||||
<h2 style="color: #fff;">Iframe Background</h2>
|
<h2 style="color: #fff;">Iframe Background</h2>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<h2>Video</h2>
|
||||||
|
<video src="https://static.slid.es/site/homepage/v1/homepage-video-editor.mp4" data-autoplay></video>
|
||||||
|
</section>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<h2>Auto-playing audio</h2>
|
<h2>Auto-playing audio</h2>
|
||||||
<audio src="assets/beeping.wav" data-autoplay></audio>
|
<audio src="assets/beeping.wav" data-autoplay></audio>
|
||||||
|
@ -59,9 +64,7 @@
|
||||||
|
|
||||||
<script src="../dist/reveal.js"></script>
|
<script src="../dist/reveal.js"></script>
|
||||||
<script>
|
<script>
|
||||||
Reveal.initialize({
|
Reveal.initialize();
|
||||||
transition: 'linear'
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
26
js/reveal.js
26
js/reveal.js
|
@ -2067,21 +2067,21 @@ export default function( revealElement, options ) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
autoSlide = config.autoSlide;
|
autoSlide = config.autoSlide;
|
||||||
}
|
|
||||||
|
|
||||||
// If there are media elements with data-autoplay,
|
// If there are media elements with data-autoplay,
|
||||||
// automatically set the autoSlide duration to the
|
// automatically set the autoSlide duration to the
|
||||||
// length of that media. Not applicable if the slide
|
// length of that media. Not applicable if the slide
|
||||||
// is divided up into fragments.
|
// is divided up into fragments.
|
||||||
// playbackRate is accounted for in the duration.
|
// playbackRate is accounted for in the duration.
|
||||||
if( currentSlide.querySelectorAll( '.fragment' ).length === 0 ) {
|
if( currentSlide.querySelectorAll( '.fragment' ).length === 0 ) {
|
||||||
Util.queryAll( currentSlide, 'video, audio' ).forEach( el => {
|
Util.queryAll( currentSlide, 'video, audio' ).forEach( el => {
|
||||||
if( el.hasAttribute( 'data-autoplay' ) ) {
|
if( el.hasAttribute( 'data-autoplay' ) ) {
|
||||||
if( autoSlide && (el.duration * 1000 / el.playbackRate ) > autoSlide ) {
|
if( autoSlide && (el.duration * 1000 / el.playbackRate ) > autoSlide ) {
|
||||||
autoSlide = ( el.duration * 1000 / el.playbackRate ) + 1000;
|
autoSlide = ( el.duration * 1000 / el.playbackRate ) + 1000;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
} );
|
||||||
} );
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cue the next auto-slide if:
|
// Cue the next auto-slide if:
|
||||||
|
|
Loading…
Reference in New Issue