mirror of
https://github.com/9001/copyparty.git
synced 2025-08-18 01:22:13 -06:00
gallery: pause/resume audio player on video
This commit is contained in:
parent
af5169f67f
commit
ec534701c8
|
@ -33,7 +33,9 @@ window.baguetteBox = (function () {
|
||||||
data = {}, // all galleries
|
data = {}, // all galleries
|
||||||
imagesElements = [],
|
imagesElements = [],
|
||||||
documentLastFocus = null,
|
documentLastFocus = null,
|
||||||
isFullscreen = false;
|
isFullscreen = false,
|
||||||
|
vmute = false,
|
||||||
|
resume_mp = false;
|
||||||
|
|
||||||
var onFSC = function (e) {
|
var onFSC = function (e) {
|
||||||
isFullscreen = !!document.fullscreenElement;
|
isFullscreen = !!document.fullscreenElement;
|
||||||
|
@ -231,8 +233,10 @@ window.baguetteBox = (function () {
|
||||||
playpause();
|
playpause();
|
||||||
else if (k == "KeyU" || k == "KeyO")
|
else if (k == "KeyU" || k == "KeyO")
|
||||||
relseek(k == "KeyU" ? -10 : 10);
|
relseek(k == "KeyU" ? -10 : 10);
|
||||||
else if (k == "KeyM" && vid())
|
else if (k == "KeyM" && vid()) {
|
||||||
vid().muted = !vid().muted;
|
vid().muted = vmute = !vmute;
|
||||||
|
mp_ctl();
|
||||||
|
}
|
||||||
else if (k == "KeyF")
|
else if (k == "KeyF")
|
||||||
try {
|
try {
|
||||||
if (isFullscreen)
|
if (isFullscreen)
|
||||||
|
@ -558,6 +562,18 @@ window.baguetteBox = (function () {
|
||||||
vid().currentTime += sec;
|
vid().currentTime += sec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function mp_ctl() {
|
||||||
|
var v = vid();
|
||||||
|
if (!vmute && v && mp.au && !mp.au.paused) {
|
||||||
|
mp.fade_out();
|
||||||
|
resume_mp = true;
|
||||||
|
}
|
||||||
|
else if (resume_mp && (vmute || !v) && mp.au && mp.au.paused) {
|
||||||
|
mp.fade_in();
|
||||||
|
resume_mp = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Triggers the bounce animation
|
* Triggers the bounce animation
|
||||||
* @param {('left'|'right')} direction - Direction of the movement
|
* @param {('left'|'right')} direction - Direction of the movement
|
||||||
|
@ -581,7 +597,12 @@ window.baguetteBox = (function () {
|
||||||
slider.style.transform = 'translate3d(' + offset + ',0,0)';
|
slider.style.transform = 'translate3d(' + offset + ',0,0)';
|
||||||
}
|
}
|
||||||
playvid(false);
|
playvid(false);
|
||||||
|
var v = vid();
|
||||||
|
if (v) {
|
||||||
playvid(true);
|
playvid(true);
|
||||||
|
v.muted = vmute;
|
||||||
|
}
|
||||||
|
mp_ctl();
|
||||||
}
|
}
|
||||||
|
|
||||||
function preloadNext(index) {
|
function preloadNext(index) {
|
||||||
|
|
Loading…
Reference in a new issue