1
0
mirror of https://github.com/hakimel/reveal.js.git synced 2025-01-16 21:08:28 +01:00

don't restart media when it's already playing #2882

This commit is contained in:
Hakim El Hattab 2024-03-11 11:24:00 +01:00
parent a29a9c71ae
commit 1748a55ece
6 changed files with 10 additions and 7 deletions

2
dist/reveal.esm.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
dist/reveal.js vendored

File diff suppressed because one or more lines are too long

2
dist/reveal.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -375,8 +375,11 @@ export default class SlideContent {
isVisible = !!closest( event.target, '.present' );
if( isAttachedToDOM && isVisible ) {
event.target.currentTime = 0;
event.target.play();
// Don't restart if media is already playing
if( event.target.paused || event.target.ended ) {
event.target.currentTime = 0;
event.target.play();
}
}
event.target.removeEventListener( 'loadeddata', this.startEmbeddedMedia );

View File

@ -2917,7 +2917,7 @@ export default function( revealElement, options ) {
loadSlide: slideContent.load.bind( slideContent ),
unloadSlide: slideContent.unload.bind( slideContent ),
// Media playback
// Start/stop all media inside of the current slide
startEmbeddedContent: () => slideContent.startEmbeddedContent( currentSlide ),
stopEmbeddedContent: () => slideContent.stopEmbeddedContent( currentSlide, { unloadIframes: false } ),