Skip to content

Commit

Permalink
fix(FEC-8136): quality tracks are filtered by height instead of by la…
Browse files Browse the repository at this point in the history
…bel (#225)

Filtering the quality tracks by label
required for support displaying quality tracks with same height by different label
e.g:
track1: {
    height: 360,
    width: 640,
    bandwidth: 700000,
    label: 'low'
},
track2: {
    height: 360,
    width: 640,
    bandwidth: 800000,
    label: 'high'
}
  • Loading branch information
yairans committed Apr 22, 2018
1 parent 30e6c89 commit afe561f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/components/settings/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ class SettingsControl extends BaseComponent {

/**
* This function gets an array and increases it if needed in each iteration. The function checks if the last element
* in the sorted array has the same resolution as the new current track element. If so, it compares their bandwidth
* and the the one with the higher. If the resolution is different then it just adds it to the array
* in the sorted array has the same label as the new current track element. If so, it compares their bandwidth
* and selects the one with the higher. If the resolution is different then it just adds it to the array
*
* @param {Array} qualities - sorted (!) video tracks array
* @param {object} currentTrack - a track
Expand All @@ -146,7 +146,7 @@ class SettingsControl extends BaseComponent {
filterUniqueQualities(qualities: Array<any>, currentTrack: any): Array<any> {
const arrLength = qualities.length - 1;
const previousTrack = qualities[arrLength];
if ((arrLength > -1) && (currentTrack.height === previousTrack.height)) {
if ((arrLength > -1) && (currentTrack.label === previousTrack.label)) {
if (currentTrack.bandwidth > previousTrack.bandwidth) {
qualities[arrLength] = currentTrack;
}
Expand Down

0 comments on commit afe561f

Please sign in to comment.