fix: maybe fix #3613

This commit is contained in:
JellyBrick
2025-09-09 23:43:42 +09:00
parent af63edb058
commit 0116188623

View File

@ -314,38 +314,37 @@ export default createPlugin({
}; };
if (config.mode !== 'native' && config.mode != 'disabled') { if (config.mode !== 'native' && config.mode != 'disabled') {
document setTimeout(() => {
.querySelector<HTMLVideoElement>('#player') const playerSelector =
?.prepend(switchButtonContainer); document.querySelector<HTMLVideoElement>('#player');
if (!playerSelector) return;
setVideoState(!config.hideVideo); playerSelector.prepend(switchButtonContainer);
forcePlaybackMode(); setVideoState(!config.hideVideo);
// Fix black video forcePlaybackMode();
if (video) { if (video) {
video.style.height = 'auto'; video.style.height = 'auto';
}
video?.addEventListener('ytmd:src-changed', videoStarted);
observeThumbnail();
videoStarted();
switch (config.align) {
case 'right': {
switchButtonContainer.style.justifyContent = 'flex-end';
return;
} }
video?.addEventListener('ytmd:src-changed', videoStarted);
observeThumbnail();
videoStarted();
switch (config.align) {
case 'right': {
switchButtonContainer.style.justifyContent = 'flex-end';
return;
}
case 'middle': { case 'middle': {
switchButtonContainer.style.justifyContent = 'center'; switchButtonContainer.style.justifyContent = 'center';
return; return;
} }
default: default:
case 'left': { case 'left': {
switchButtonContainer.style.justifyContent = 'flex-start'; switchButtonContainer.style.justifyContent = 'flex-start';
}
} }
} }, 0);
} }
}, },
onConfigChange(newConfig) { onConfigChange(newConfig) {