From 089518c0e18fa9dd3f7fee2b9e5dfd95426dc6df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Velad=20Galv=C3=A1n?= Date: Tue, 16 Jul 2024 08:17:01 +0200 Subject: [PATCH] fix(UI): Fix resolution label when the stream has not resolution (#7043) --- ui/resolution_selection.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/ui/resolution_selection.js b/ui/resolution_selection.js index ef85a4528..416851d1c 100644 --- a/ui/resolution_selection.js +++ b/ui/resolution_selection.js @@ -154,9 +154,7 @@ shaka.ui.ResolutionSelection = class extends shaka.ui.SettingsMenu { }); } else { tracks.sort((t1, t2) => { - goog.asserts.assert(t1.height != null, 'Null height'); - goog.asserts.assert(t2.height != null, 'Null height'); - if (t2.height == t1.height) { + if (t2.height == t1.height || t1.height == null || t2.height == null) { return t2.bandwidth - t1.bandwidth; } return t2.height - t1.height; @@ -184,10 +182,10 @@ shaka.ui.ResolutionSelection = class extends shaka.ui.SettingsMenu { () => this.onTrackSelected_(track)); const span = shaka.util.Dom.createHTMLElement('span'); - if (this.player.isAudioOnly() && track.bandwidth) { - span.textContent = Math.round(track.bandwidth / 1000) + ' kbits/s'; - } else if (track.height && track.width) { + if (!this.player.isAudioOnly() && track.height && track.width) { span.textContent = this.getResolutionLabel_(track, tracks); + } else if (track.bandwidth) { + span.textContent = Math.round(track.bandwidth / 1000) + ' kbits/s'; } else { span.textContent = 'Unknown'; }