diff --git a/src/ext/lib/video-data/PlayerData.ts b/src/ext/lib/video-data/PlayerData.ts index 12f7771..f623fd1 100644 --- a/src/ext/lib/video-data/PlayerData.ts +++ b/src/ext/lib/video-data/PlayerData.ts @@ -72,11 +72,16 @@ class PlayerData { * Gets player aspect ratio. If in full screen, it returns screen aspect ratio unless settings say otherwise. */ get aspectRatio() { - if (this.dimensions.fullscreen && !this.settings.getSettingsForSite()?.usePlayerArInFullscreen) { - return window.innerWidth / window.innerHeight; - } + try { + if (this.dimensions?.fullscreen && !this.settings.getSettingsForSite()?.usePlayerArInFullscreen) { + return window.innerWidth / window.innerHeight; + } - return this.dimensions.width / this.dimensions.height; + return this.dimensions.width / this.dimensions.height; + } catch (e) { + console.error('cannot determine aspect ratio!', e); + return 1; + } } constructor(videoData) { diff --git a/src/ext/lib/video-data/VideoData.ts b/src/ext/lib/video-data/VideoData.ts index f493e79..b7d4416 100644 --- a/src/ext/lib/video-data/VideoData.ts +++ b/src/ext/lib/video-data/VideoData.ts @@ -49,7 +49,12 @@ class VideoData { get aspectRatio() { - return this.video.videoWidth / this.video.videoHeight; + try { + return this.video.videoWidth / this.video.videoHeight; + } catch (e) { + console.error('cannot determine stream aspect ratio!', e); + return 1; + } } constructor(video, settings, pageInfo){