Add delay before stopping other video players during slideshow transitions
This commit is contained in:
@@ -2393,30 +2393,32 @@ const SlideshowManager = {
|
|||||||
|
|
||||||
// Manage Video Playback: Stop others, Play current
|
// Manage Video Playback: Stop others, Play current
|
||||||
// 1. Stop all other YouTube players and local video elements, release connections
|
// 1. Stop all other YouTube players and local video elements, release connections
|
||||||
if (STATE.slideshow.videoPlayers) {
|
setTimeout(() => {
|
||||||
Object.keys(STATE.slideshow.videoPlayers).forEach(id => {
|
if (STATE.slideshow.videoPlayers) {
|
||||||
if (id !== currentItemId) {
|
Object.keys(STATE.slideshow.videoPlayers).forEach(id => {
|
||||||
const p = STATE.slideshow.videoPlayers[id];
|
if (id !== currentItemId) {
|
||||||
if (!p) return;
|
const p = STATE.slideshow.videoPlayers[id];
|
||||||
// YouTube player
|
if (!p) return;
|
||||||
if (typeof p.pauseVideo === 'function') {
|
// YouTube player
|
||||||
p.pauseVideo();
|
if (typeof p.pauseVideo === 'function') {
|
||||||
}
|
p.pauseVideo();
|
||||||
// HTML5 <video> element (local trailers), release HTTP connection
|
}
|
||||||
if (p instanceof HTMLVideoElement) {
|
// HTML5 <video> element (local trailers), release HTTP connection
|
||||||
p.pause();
|
if (p instanceof HTMLVideoElement) {
|
||||||
p.muted = true;
|
p.pause();
|
||||||
p.currentTime = 0;
|
p.muted = true;
|
||||||
// Save src to data-src and release the HTTP streaming connection
|
p.currentTime = 0;
|
||||||
if (p.src && !p.getAttribute('data-src')) {
|
// Save src to data-src and release the HTTP streaming connection
|
||||||
p.setAttribute('data-src', p.src);
|
if (p.src && !p.getAttribute('data-src')) {
|
||||||
|
p.setAttribute('data-src', p.src);
|
||||||
|
}
|
||||||
|
p.removeAttribute('src');
|
||||||
|
p.load();
|
||||||
}
|
}
|
||||||
p.removeAttribute('src');
|
|
||||||
p.load();
|
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
}
|
}, CONFIG.fadeTransitionDuration);
|
||||||
|
|
||||||
// 2. Pause all other HTML5 videos e.g. local trailers
|
// 2. Pause all other HTML5 videos e.g. local trailers
|
||||||
document.querySelectorAll('video').forEach(video => {
|
document.querySelectorAll('video').forEach(video => {
|
||||||
|
|||||||
Reference in New Issue
Block a user