Uncaught error thrown on representation switch when init segment has previously been cached
Created by: davemevans
Uncaught Error: 'type' is a reserved word for event dispatching
at Object.trigger (EventBus.js:84)
at appendToBuffer (BufferController.js:201)
at Object.switchInitData (BufferController.js:163)
at getNextFragment (ScheduleController.js:205)
at schedule (ScheduleController.js:229)
This seems to have been caused by https://github.com/Dash-Industry-Forum/dash.js/pull/1844, specifically by an error when triggering the new event VIDEO_CHUNK_RECEIVED
.
The problem is that the second argument to trigger
is modified by that function, so it is important that it is a new object containing the object to be passed, rather than the object itself. As it is implemented today, the chunk has a new attribute type
added to it and is subsequently cached. When the chunk is retrieved and appended later, the call to trigger
detects the reserved type
attribute and throws an exception.
I'll issue a PR shortly.