Skip to content

Commit

Permalink
Removed fullscreen handling in DefaultRenderer.
Browse files Browse the repository at this point in the history
It was hacky when it was first written - it required max z-index on the subs wrapper to be visible over the fullscreen video. Now it works on even fewer browsers.

Users who want subs on fullscreen video should implement their own fullscreen functionality to make both the video and the subs wrapper fullscreen.
  • Loading branch information
Arnavion committed Jan 23, 2016
1 parent 45f081b commit 795bef9
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 67 deletions.
4 changes: 0 additions & 4 deletions lib/libjass.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@
overflow: hidden;
}

.libjass-wrapper.libjass-full-screen {
position: static;
}

.libjass-subs {
position: absolute;
overflow: hidden;
Expand Down
31 changes: 0 additions & 31 deletions src/renderers/default-references.d.ts

This file was deleted.

32 changes: 0 additions & 32 deletions src/renderers/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ import { ASS } from "../types/ass";
* @param {libjass.renderers.RendererSettings} settings
*/
export class DefaultRenderer extends WebRenderer {
private _videoIsFullScreen: boolean = false;

constructor(private _video: HTMLVideoElement, ass: ASS, settings?: RendererSettings) {
super(ass, new VideoClock(_video), document.createElement("div"), settings);

Expand All @@ -53,38 +51,8 @@ export class DefaultRenderer extends WebRenderer {
}

protected _ready(): void {
document.addEventListener("mozfullscreenchange", event => this._onFullScreenChange(document.mozFullScreenElement), false);
document.addEventListener("webkitfullscreenchange", event => this._onFullScreenChange(document.webkitFullscreenElement), false);
document.addEventListener("fullscreenchange", event => this._onFullScreenChange(document.fullscreenElement), false);

this.resize(this._video.offsetWidth, this._video.offsetHeight);

super._ready();
}

/**
* @param {!Element} fullScreenElement
*/
private _onFullScreenChange(fullScreenElement: Element): void {
if (fullScreenElement === undefined) {
fullScreenElement = document.msFullscreenElement;
}

if (fullScreenElement === this._video) {
this.libjassSubsWrapper.classList.add("libjass-full-screen");

this.resize(screen.width, screen.height);

this._videoIsFullScreen = true;

this._dispatchEvent("fullScreenChange", [this._videoIsFullScreen]);
}
else if (fullScreenElement === null && this._videoIsFullScreen) {
this.libjassSubsWrapper.classList.remove("libjass-full-screen");

this._videoIsFullScreen = false;

this._dispatchEvent("fullScreenChange", [this._videoIsFullScreen]);
}
}
}

0 comments on commit 795bef9

Please sign in to comment.