Basic mode: when switching to full screen, restart ar detection proper

This commit is contained in:
Tamius Han 2018-11-02 21:41:26 +01:00
parent 985e285914
commit 32f868a91c
2 changed files with 9 additions and 5 deletions

View File

@ -143,7 +143,7 @@ class PlayerData {
if (this.checkFullscreenChange()) {
if (PlayerData.isFullScreen()) {
this.videoData.resizer.restore();
this.videoData.startArDetection();
this.videoData.rebootArDetection();
} else {
const lastAr = this.videoData.resizer.getLastAr(); // save last ar for restore later
this.videoData.resizer.reset();
@ -159,7 +159,6 @@ class PlayerData {
this.ghettoWatcherFull();
this.scheduleGhettoWatcher();
} else if (this.extensionMode === ExtensionMode.Basic) {
console.log("ghetto watcher basic mode - triggered")
this.ghettoWatcherBasic();
this.scheduleGhettoWatcher();
}
@ -309,8 +308,6 @@ class PlayerData {
checkFullscreenChange() {
const isFs = PlayerData.isFullScreen();
console.log("isFs:", isFs)
if (this.dimensions) {
if (this.dimensions.fullscreen != isFs) {
this.dimensions = {
@ -324,7 +321,7 @@ class PlayerData {
}
if(Debug.debug) {
console.log("[PlayerData::checkFullscreenChange] this.dimensions is not defined.")
console.log("[PlayerData::checkFullscreenChange] this.dimensions is not defined. Assuming fs change happened and setting default values.")
}
this.dimensions = {

View File

@ -56,6 +56,13 @@ class VideoData {
this.arDetector.start();
}
rebootArDetection() {
if(this.destroyed) {
throw {error: 'VIDEO_DATA_DESTROYED', data: {videoData: this}};
}
this.arDetector.init();
}
stopArDetection() {
if (this.arDetector) {
this.arDetector.stop();