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

fix(preload): Fix timing of call to stopQueuingLatePhaseQueuedOperations #6238

Merged
merged 1 commit into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -1557,13 +1557,13 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
await this.loadInner_(
startTimeOfLoad, prefetchedVariant, segmentPrefetchById);
}, 'loadInner_');
preloadManager.stopQueuingLatePhaseQueuedOperations();
}
this.dispatchEvent(shaka.Player.makeEvent_(
shaka.util.FakeEvent.EventName.Loaded));
} catch (error) {
if (error.code != shaka.util.Error.Code.LOAD_INTERRUPTED) {
await this.unload(/* initializeMediaSource= */ false);
preloadManager.stopQueuingLatePhaseQueuedOperations();
}
throw error;
} finally {
Expand Down
16 changes: 16 additions & 0 deletions test/player_unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,22 @@ describe('Player', () => {
expect(player.getLoadMode()).toBe(shaka.Player.LoadMode.MEDIA_SOURCE);
});
});

it('fires keystatuschanged events', async () => {
const keyStatusChanged = jasmine.createSpy('keyStatusChanged');
player.addEventListener(
'keystatuschanged', Util.spyFunc(keyStatusChanged));
player.createDrmEngine = (playerInterface) => {
// Call the onKeyStatus on the playerInterface, before load is finished.
playerInterface.onKeyStatus({
'aaa': 'usable',
'bbb': 'output-restricted',
});
return drmEngine;
};
await player.load(fakeManifestUri, 0, fakeMimeType);
expect(keyStatusChanged).toHaveBeenCalled();
});
}); // describe('load/unload')

describe('getConfiguration', () => {
Expand Down