Search code examples
htmlmedia-source

How to get specific error message from SourceBuffer


I have an HTML5 video with a MediaSource for its source. When I call SourceBuffer.appendBuffer() the SourceBuffer throws an error.

I'm able to detect when this error is thrown like so:

sourceBuffer.addEventListener("error", function() {
    console.log(arguments);
});

However the "arguments" in this case contain an ErrorEvent with no meaningful message or data. Just a reference to the SourceBuffer that failed.

I need to figure out why it failed, so I can fix it.


Solution

  • Yes, this is one of the most frustrating parts about MSE... it's really difficult to debug. I think the issue is that the errors have to be standardized from browser to browser. Since there's a lot of

    If you're using Chrome, the best place to look is chrome://media-internals.

    As of Chrome 91 the media-internals pane is removed. Instead. go to

    DevTools / hamburger menu (=== Customize and Control DevTools) / More Tools ▶ / Media

    Then you'll have a Media tab on DevTools.