Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/web/mpv-video-player.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,26 @@
return mediaStreams.find(s => s.Index === index) || null;
}

// Third-party themes/plugins (custom CSS plugins, injected scripts) can set
// an opaque background on body & friends with !important, which paints over
// the transparent window and hides the mpv video underneath. Outrank them
// with higher-specificity rules scoped to jellyfin-web's transparentDocument
// playback state.
function ensureTransparencyGuard() {
if (document.getElementById('mpvTransparencyGuard')) return;
const style = document.createElement('style');
style.id = 'mpvTransparencyGuard';
style.textContent = `
html.transparentDocument,
.transparentDocument body,
.transparentDocument .backgroundContainer,
.transparentDocument .skinBody,
.transparentDocument .videoPlayerContainer {
background: transparent !important;
}`;
document.head.appendChild(style);
}

class mpvVideoPlayer extends window.MpvPlayerBase {
constructor(args) {
super(args);
Expand Down Expand Up @@ -264,6 +284,7 @@
}

createMediaElement(options) {
ensureTransparencyGuard();
let dlg = document.querySelector('.videoPlayerContainer');
const isNewDlg = !dlg;
if (isNewDlg) {
Expand Down