alotta good shit
This commit is contained in:
+26
-6
@@ -815,13 +815,33 @@ class v0ck {
|
||||
// Attempt autoplay and show overlay if blocked
|
||||
const shouldAutoplay = !isBlurredDetail && window.f0ckSession?.disable_autoplay !== true;
|
||||
if (shouldAutoplay) {
|
||||
const playPromise = togglePlay();
|
||||
if (playPromise !== undefined) {
|
||||
playPromise.catch(() => {
|
||||
if (!video.paused) {
|
||||
player.classList.remove('v0ck_initial');
|
||||
} else {
|
||||
const playPromise = video.play();
|
||||
if (playPromise !== undefined) {
|
||||
playPromise.then(() => {
|
||||
player.classList.remove('v0ck_initial');
|
||||
}).catch((err) => {
|
||||
if (err && err.name === 'AbortError') {
|
||||
const onCanPlay = () => {
|
||||
video.removeEventListener('canplay', onCanPlay);
|
||||
if (video.paused) {
|
||||
video.play().then(() => {
|
||||
player.classList.remove('v0ck_initial');
|
||||
}).catch(() => {
|
||||
player.classList.add('v0ck_initial');
|
||||
});
|
||||
}
|
||||
};
|
||||
video.addEventListener('canplay', onCanPlay, { once: true });
|
||||
} else {
|
||||
player.classList.add('v0ck_initial');
|
||||
}
|
||||
});
|
||||
} else if (video.paused) {
|
||||
player.classList.add('v0ck_initial');
|
||||
});
|
||||
} else if (video.paused) {
|
||||
player.classList.add('v0ck_initial');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
player.classList.add('v0ck_initial');
|
||||
|
||||
Reference in New Issue
Block a user