Skip to content

Commit

Permalink
Fixed bug with fullscreen mode and also created new function for doub…
Browse files Browse the repository at this point in the history
…le press on player so the fullscreen won't break
  • Loading branch information
SebiWrn committed Jan 10, 2024
1 parent 25b3b04 commit 8d59717
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions web/ts/splitview.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { getPlayers } from "./TUMLiveVjs";
import Split from "split.js";
import { cloneEvents } from "./global";
import videojs, {VideoJsPlayer} from "video.js";
import PlayerOptions = videojs.PlayerOptions;

const mouseMovingTimeout = 2200;

Expand Down Expand Up @@ -152,12 +154,21 @@ export class SplitView {
fullscreenToggle.off("click");

fullscreenToggle.on("click", async () => {
if (document.fullscreenElement === null) {
await this.splitParent.requestFullscreen();
} else {
await document.exitFullscreen();
}
await this.toggleFullscreen();
});

(this.players[0] as VideoJsPlayer).options_.userActions.doubleClick = async () => await this.toggleFullscreen();
(this.players[1] as VideoJsPlayer).options_.userActions.doubleClick = async () => await this.toggleFullscreen();

this.splitParent.addEventListener("fullscreenchange", () => this.update(25))
}

private async toggleFullscreen() {
if (document.fullscreenElement === null) {
await this.splitParent.requestFullscreen();
} else {
await document.exitFullscreen();
}
}

private setTrackBarModes(k: number, mode: string) {
Expand Down

0 comments on commit 8d59717

Please sign in to comment.