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 (this.checkFullscreenChange()) {
if (PlayerData.isFullScreen()) { if (PlayerData.isFullScreen()) {
this.videoData.resizer.restore(); this.videoData.resizer.restore();
this.videoData.startArDetection(); this.videoData.rebootArDetection();
} else { } else {
const lastAr = this.videoData.resizer.getLastAr(); // save last ar for restore later const lastAr = this.videoData.resizer.getLastAr(); // save last ar for restore later
this.videoData.resizer.reset(); this.videoData.resizer.reset();
@ -159,7 +159,6 @@ class PlayerData {
this.ghettoWatcherFull(); this.ghettoWatcherFull();
this.scheduleGhettoWatcher(); this.scheduleGhettoWatcher();
} else if (this.extensionMode === ExtensionMode.Basic) { } else if (this.extensionMode === ExtensionMode.Basic) {
console.log("ghetto watcher basic mode - triggered")
this.ghettoWatcherBasic(); this.ghettoWatcherBasic();
this.scheduleGhettoWatcher(); this.scheduleGhettoWatcher();
} }
@ -309,8 +308,6 @@ class PlayerData {
checkFullscreenChange() { checkFullscreenChange() {
const isFs = PlayerData.isFullScreen(); const isFs = PlayerData.isFullScreen();
console.log("isFs:", isFs)
if (this.dimensions) { if (this.dimensions) {
if (this.dimensions.fullscreen != isFs) { if (this.dimensions.fullscreen != isFs) {
this.dimensions = { this.dimensions = {
@ -324,7 +321,7 @@ class PlayerData {
} }
if(Debug.debug) { 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 = { this.dimensions = {

View File

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