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