Skip to content

Commit

Permalink
Fix PlaybackErrorEvent error TS typing (#4363)
Browse files Browse the repository at this point in the history
`PlaybackErrorEvent` when triggered in `PlaybackController`, attaches
the original `MediaError` as `error` property.  This commit corrects the
TS typing to reflect that.
  • Loading branch information
kris-youview committed Jan 18, 2024
1 parent 248ea30 commit 49257d9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions index.d.ts
Expand Up @@ -1846,7 +1846,7 @@ declare namespace dashjs {

export interface PlaybackErrorEvent extends Event {
type: MediaPlayerEvents['PLAYBACK_ERROR'];
error: string;
error: MediaError;
}

export interface PlaybackPausedEvent extends Event {
Expand Down Expand Up @@ -4462,4 +4462,3 @@ declare namespace dashjs {
export type ResponseFilter = (response: LicenseResponse) => Promise<any>;
}


4 changes: 2 additions & 2 deletions test/unit/streaming.controllers.PlaybackControllers.js
Expand Up @@ -402,12 +402,12 @@ describe('PlaybackController', function () {
let onError = function (e) {
eventBus.off(Events.PLAYBACK_ERROR, onError);

expect(e.error).to.equal('error');
expect(e.error.message).to.equal('error');
done();
};

eventBus.on(Events.PLAYBACK_ERROR, onError, this);
videoModelMock.fireEvent('error', [{ target: { error: 'error' } }]);
videoModelMock.fireEvent('error', [{ target: { error: { code: 3, message: 'error' } } }]);
});

it('should handle stalled event', function (done) {
Expand Down

0 comments on commit 49257d9

Please sign in to comment.