fix fs handlers
This commit is contained in:
parent
0ba56c271d
commit
388327ec1d
@ -73,6 +73,13 @@ class PageInfo {
|
||||
fsStatus = {fullscreen: true}; // fsStatus needs to be passed to VideoData, so fullScreen property is shared between videoData instances
|
||||
//#endregion
|
||||
|
||||
fsEventListener = {
|
||||
that: this,
|
||||
handleEvent: function(event: Event) {
|
||||
this.that.fullscreenHandler();
|
||||
}
|
||||
};
|
||||
|
||||
constructor(eventBus: EventBus, siteSettings: SiteSettings, settings: Settings, logger: Logger, readOnly = false){
|
||||
this.logger = logger;
|
||||
this.settings = settings;
|
||||
@ -84,8 +91,6 @@ class PageInfo {
|
||||
this.isFullscreen = !!document.fullscreenElement;
|
||||
this.iframeManager = new IframeManager({eventBus});
|
||||
|
||||
|
||||
|
||||
if (eventBus){
|
||||
this.eventBus = eventBus;
|
||||
}
|
||||
@ -103,7 +108,7 @@ class PageInfo {
|
||||
this.rescan(RescanReason.PERIODIC);
|
||||
this.scheduleUrlCheck();
|
||||
|
||||
document.addEventListener('fullscreenchange', this.fullscreenHandler);
|
||||
document.addEventListener('fullscreenchange', this.fsEventListener);
|
||||
}
|
||||
|
||||
destroy() {
|
||||
@ -147,15 +152,15 @@ class PageInfo {
|
||||
/**
|
||||
* Handler for fullscreenchanged event.
|
||||
*/
|
||||
fullscreenHandler() {
|
||||
this.isFullscreen = !!document.fullscreenElement;
|
||||
fullscreenHandler() {
|
||||
this.isFullscreen = !!document.fullscreenElement;
|
||||
|
||||
if (this.isFullscreen) {
|
||||
this.enterFullscreen();
|
||||
} else {
|
||||
this.exitFullscreen();
|
||||
}
|
||||
if (this.isFullscreen) {
|
||||
this.enterFullscreen();
|
||||
} else {
|
||||
this.exitFullscreen();
|
||||
}
|
||||
}
|
||||
|
||||
reset() {
|
||||
for(let video of this.videos) {
|
||||
|
@ -69,7 +69,7 @@ class PlayerData {
|
||||
private playerIdElement: any;
|
||||
private observer: ResizeObserver;
|
||||
|
||||
private ui: any;
|
||||
private ui: UI;
|
||||
|
||||
elementStack: any[] = [];
|
||||
//#endregion
|
||||
@ -88,6 +88,13 @@ class PlayerData {
|
||||
}
|
||||
//#endregion
|
||||
|
||||
private dimensionChangeListener = {
|
||||
that: this,
|
||||
handleEvent: function(event: Event) {
|
||||
this.that.trackDimensionChanges()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets player aspect ratio. If in full screen, it returns screen aspect ratio unless settings say otherwise.
|
||||
*/
|
||||
@ -145,7 +152,7 @@ class PlayerData {
|
||||
this.trackDimensionChanges();
|
||||
this.startChangeDetection();
|
||||
|
||||
document.addEventListener('fullscreenchange', this.trackDimensionChanges);
|
||||
document.addEventListener('fullscreenchange', this.dimensionChangeListener);
|
||||
|
||||
// we want to reload on storage changes
|
||||
this.siteSettings.subscribeToStorageChange('PlayerData', (siteConfUpdate) => this.reloadPlayerDataConfig(siteConfUpdate));
|
||||
@ -183,7 +190,7 @@ class PlayerData {
|
||||
}
|
||||
|
||||
destroy() {
|
||||
document.removeEventListener('fullscreenchange', this.trackDimensionChanges);
|
||||
document.removeEventListener('fullscreenchange', this.dimensionChangeListener);
|
||||
this.stopChangeDetection();
|
||||
this.destroyOverlay();
|
||||
this.notificationService?.destroy();
|
||||
|
Loading…
Reference in New Issue
Block a user