Skip to content

Commit

Permalink
Revert "Restrict tracks that we don't have keys for."
Browse files Browse the repository at this point in the history
This reverts commit aefb0d1.
  • Loading branch information
jforbes committed Jun 19, 2017
1 parent 45dc92e commit 4a704b6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 31 deletions.
8 changes: 3 additions & 5 deletions lib/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -2553,12 +2553,10 @@ shaka.Player.prototype.onKeyStatus_ = function(keyStatusMap) {
streams.forEach(function(stream) {
var originalAllowed = variant.allowedByKeySystem;

// Only update if we have a key ID for the stream. If the key isn't
// present, then we don't have that key and it should be restricted.
if (stream.keyId) {
// Only update the status if it is in the map.
if (stream.keyId && stream.keyId in keyStatusMap) {
var keyStatus = keyStatusMap[stream.keyId];
variant.allowedByKeySystem =
!!keyStatus && restrictedStatuses.indexOf(keyStatus) < 0;
variant.allowedByKeySystem = restrictedStatuses.indexOf(keyStatus) < 0;
}

if (originalAllowed != variant.allowedByKeySystem) {
Expand Down
26 changes: 0 additions & 26 deletions test/player_unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -1792,32 +1792,6 @@ describe('Player', function() {
}).then(done);
});

it('removes if we don\'t have the required key', function(done) {
manifest = new shaka.test.ManifestGenerator()
.addPeriod(0)
.addVariant(0)
.addVideo(1).keyId('abc')
.addVariant(2)
.addVideo(3)
.build();

parser = new shaka.test.FakeManifestParser(manifest);
factory = function() { return parser; };
player.load('', 0, factory).then(function() {
// "initialize" the current period.
chooseStreams();
canSwitch();
}).then(function() {
expect(player.getVariantTracks().length).toBe(2);

onKeyStatus({});

var tracks = player.getVariantTracks();
expect(tracks.length).toBe(1);
expect(tracks[0].id).toBe(2);
}).catch(fail).then(done);
});

it('removes if key system does not support codec', function(done) {
manifest = new shaka.test.ManifestGenerator()
.addPeriod(0)
Expand Down

0 comments on commit 4a704b6

Please sign in to comment.