TypeError: Cannot read property 'removeEventListener' of null
Created by: ahfarmer
Environment
-
The MPD passes the DASH-IF Conformance Tool on http://dashif.org/conformance.html -
The stream has correct Access-Control-Allow-Origin headers (CORS) -
There are no network errors such as 404s in the browser console when trying to play the stream -
The issue observed is not mentioned on https://github.com/Dash-Industry-Forum/dash.js/wiki/FAQ -
The issue occurs in the latest reference client on http://reference.dashif.org/dash.js/ and not just on my page (Private feed that I can't play in the reference client)
- Link to playable MPD file: Not available - private feed
- Dash.js version: 2.6.7
- Browser name/version: Chrome 65
- OS name/version: Unknown
Steps to reproduce
Not available - error came in through New Relic Browser JS Error monitoring.
Observed behaviour
TypeError: Cannot read property 'removeEventListener' of null
On this line:
https://github.com/Dash-Industry-Forum/dash.js/blob/b4b0a844e12a4dbf337efb5f4b44df95854ae096/src/streaming/controllers/StreamController.js#L431
Fix
Looks like it is possible for mediaSource
to be set to null before the sourceopen
event fires. mediaSource
is set to null here:
https://github.com/Dash-Industry-Forum/dash.js/blob/b4b0a844e12a4dbf337efb5f4b44df95854ae096/src/streaming/controllers/StreamController.js#L889
I suggest that the sourceopen
event listener be removed before mediaSource
is set to null. I'd be happy to submit a pull request if someone knowledgeable could verify that this is a good idea.