Skip to content

Commit

Permalink
fix(UI): Fix resolution label when the stream has not resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
avelad committed Jul 15, 2024
1 parent d1435c7 commit 47d5dda
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions ui/resolution_selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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';
}
Expand Down

0 comments on commit 47d5dda

Please sign in to comment.