Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: enable playlists with 'usable' keystatus #1460

Merged
merged 28 commits into from
Dec 13, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
playlist checks
  • Loading branch information
adrums86 committed Dec 8, 2023
commit 2b9a74f18550bedc649ab769f48a6e7e94c45c32
4 changes: 4 additions & 0 deletions src/dash-playlist-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -928,25 +928,29 @@
}
}

excludeNonUsablePlaylists() {
this.mainPlaylistLoader_.main.playlists.forEach((playlist) => {
if (!playlist.contentProtection.mp4protection ||
!playlist.contentProtection.mp4protection.attributes['cenc:default_KID']) {
return;

Check warning on line 935 in src/dash-playlist-loader.js

View check run for this annotation

Codecov / codecov/patch

src/dash-playlist-loader.js#L931-L935

Added lines #L931 - L935 were not covered by tests
}
const playlistKID = playlist.contentProtection.mp4protection.attributes['cenc:default_KID'].replace('-', '');
const hasUsableKeystatus = this.keyStatusMap.has(playlistKID) && this.keyStatusMap.get(playlistKID) === 'usable';

Check warning on line 938 in src/dash-playlist-loader.js

View check run for this annotation

Codecov / codecov/patch

src/dash-playlist-loader.js#L937-L938

Added lines #L937 - L938 were not covered by tests

if (!hasUsableKeystatus) {
playlist.excludeUntil = Infinity;
playlist.lastExcludeReason_ = 'non-usable';

Check warning on line 942 in src/dash-playlist-loader.js

View check run for this annotation

Codecov / codecov/patch

src/dash-playlist-loader.js#L940-L942

Added lines #L940 - L942 were not covered by tests
} else {
delete playlist.excludeUntil;
delete playlist.lastExcludeReason_;

Check warning on line 945 in src/dash-playlist-loader.js

View check run for this annotation

Codecov / codecov/patch

src/dash-playlist-loader.js#L944-L945

Added lines #L944 - L945 were not covered by tests
}
});
}

addKeyStatus(keyId, status) {

Check warning on line 950 in src/dash-playlist-loader.js

View check run for this annotation

Codecov / codecov/patch

src/dash-playlist-loader.js#L950

Added line #L950 was not covered by tests
// 32 digit keyId hex string.
const keyIdHexString = arrayBufferToHexString(keyId).slice(0, 32);

Check warning on line 952 in src/dash-playlist-loader.js

View check run for this annotation

Codecov / codecov/patch

src/dash-playlist-loader.js#L952

Added line #L952 was not covered by tests

this.keyStatusMap_.set(keyIdHexString, status);

Check warning on line 954 in src/dash-playlist-loader.js

View check run for this annotation

Codecov / codecov/patch

src/dash-playlist-loader.js#L954

Added line #L954 was not covered by tests
}
}
Loading