Skip to content

Commit

Permalink
Fix PlaybackErrorEvent error TS typing (Dash-Industry-Forum#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 authored and eirikbjornr committed Feb 14, 2024
1 parent 15ec5c3 commit 0a6b34d
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
Original file line number Diff line number Diff line change
Expand Up @@ -1847,7 +1847,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 @@ -4465,4 +4465,3 @@ declare namespace dashjs {
export type ResponseFilter = (response: LicenseResponse) => Promise<any>;
}


4 changes: 2 additions & 2 deletions test/unit/streaming.controllers.PlaybackControllers.js
Original file line number Diff line number Diff line change
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 0a6b34d

Please sign in to comment.