try/catch in aspect ratio getter
This commit is contained in:
parent
0bed840b6f
commit
60f940f4db
@ -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) {
|
||||
|
@ -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){
|
||||
|
Loading…
Reference in New Issue
Block a user