Skip to content

Commit

Permalink
feat(league): support player focus (webcam only)
Browse files Browse the repository at this point in the history
  • Loading branch information
timotheeg committed Oct 19, 2024
1 parent ab2a4e8 commit 4fb1f40
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion public/views/mp/league.html
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,15 @@
right: var(--offset);
}

.player_vid.focused {
width: 1920px;
height: 1080px;
top: 0;
left: -960px;
right: 960px;
z-index: 10;
}

#ticker {
position: absolute;
width: 1920px;
Expand Down Expand Up @@ -508,7 +517,22 @@
}, CYCLE_TDIFF * 1000);
}

const competition = new Competition(players);
let focusedPlayer = null;

const competition = new Competition(players, {
focusPlayer: pidx => {
if (focusedPlayer?.dom?._video_iframe) {
focusedPlayer.dom._video_iframe.classList.remove('focused');
}
if (pidx === null) {
focusedPlayer = null;
return;
} else if (players[pidx]) {
focusedPlayer = players[pidx];
focusedPlayer.dom._video_iframe?.classList.add('focused');
}
},
});

// expose API into window for debugging
window._players = players;
Expand Down

0 comments on commit 4fb1f40

Please sign in to comment.