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
strings
  • Loading branch information
adrums86 committed Dec 12, 2023
commit 6ce844d2cdb7d6e047d8b2fe72231f93bd6a45e1
12 changes: 5 additions & 7 deletions src/playlist-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -979,10 +979,6 @@
* @private
*/
fastQualityChange_(media = this.selectPlaylist()) {
if (!media) {
return;
}

if (media === this.mainPlaylistLoader_.media()) {
this.logger_('skipping fastQualityChange because new media is same as old');
return;
Expand Down Expand Up @@ -2396,7 +2392,7 @@
excludeNonUsablePlaylistsByKeyId_() {

if (!this.mainPlaylistLoader_ || !this.mainPlaylistLoader_.main) {
return;

Check warning on line 2395 in src/playlist-controller.js

View check run for this annotation

Codecov / codecov/patch

src/playlist-controller.js#L2395

Added line #L2395 was not covered by tests
}

this.mainPlaylistLoader_.main.playlists.forEach((playlist) => {
Expand All @@ -2407,15 +2403,17 @@
return;
}
keyIdSet.forEach((key) => {
const hasUsableKeyStatus = this.keyStatusMap_.has(key) && this.keyStatusMap_.get(key) === 'usable';
const nonUsableExclusion = playlist.lastExcludeReason_ === 'non-usable' && playlist.excludeUntil === Infinity;
const USABLE = 'usable';
const NON_USABLE = 'non-usable';
const hasUsableKeyStatus = this.keyStatusMap_.has(key) && this.keyStatusMap_.get(key) === USABLE;
const nonUsableExclusion = playlist.lastExcludeReason_ === NON_USABLE && playlist.excludeUntil === Infinity;

if (!hasUsableKeyStatus) {
playlist.excludeUntil = Infinity;
playlist.lastExcludeReason_ = 'non-usable';
playlist.lastExcludeReason_ = NON_USABLE;
} else if (hasUsableKeyStatus && nonUsableExclusion) {
delete playlist.excludeUntil;
delete playlist.lastExcludeReason_;

Check warning on line 2416 in src/playlist-controller.js

View check run for this annotation

Codecov / codecov/patch

src/playlist-controller.js#L2415-L2416

Added lines #L2415 - L2416 were not covered by tests
wseymour15 marked this conversation as resolved.
Show resolved Hide resolved
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add logs for cases when we exclude it and when we restore it back

});
});
Expand Down Expand Up @@ -2449,8 +2447,8 @@
const keystatusChange = 'keystatus-change';

if (newPlaylist !== oldPlaylist) {
this.logger_(`switching playlist from ${oldPlaylist.id} to ${newPlaylist.id} due to a ${keystatusChange}`);
this.switchMedia_(newPlaylist, keystatusChange);

Check warning on line 2451 in src/playlist-controller.js

View check run for this annotation

Codecov / codecov/patch

src/playlist-controller.js#L2450-L2451

Added lines #L2450 - L2451 were not covered by tests
}
}
}