Enhance video playback control by adding pause functionality for inactive slides
This commit is contained in:
@@ -1918,8 +1918,14 @@ const SlideCreator = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
'onStateChange': (event) => {
|
'onStateChange': (event) => {
|
||||||
// Fade in when playing
|
|
||||||
if (event.data === YT.PlayerState.PLAYING) {
|
if (event.data === YT.PlayerState.PLAYING) {
|
||||||
|
const slide = document.querySelector(`.slide[data-item-id="${itemId}"]`);
|
||||||
|
if (slide && STATE.slideshow.playSignals[itemId] === false) {
|
||||||
|
event.target.pauseVideo();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fade in when legitimately playing
|
||||||
if (event.target._wrapperDiv) {
|
if (event.target._wrapperDiv) {
|
||||||
event.target._wrapperDiv.style.opacity = "1";
|
event.target._wrapperDiv.style.opacity = "1";
|
||||||
}
|
}
|
||||||
@@ -1974,6 +1980,11 @@ const SlideCreator = {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (STATE.slideshow.playSignals[itemId] === false) {
|
||||||
|
event.target.pause();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Fade in
|
// Fade in
|
||||||
event.target.style.opacity = "1";
|
event.target.style.opacity = "1";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user