video-dev / hls.js

HLS.js is a JavaScript library that plays HLS in browsers with support for MSE.
https://hlsjs.video-dev.org/demo
Other
14.47k stars 2.55k forks source link

Improve Error Handling for "attachMedia" with Null #6463

Closed fullmooooon closed 4 days ago

fullmooooon commented 1 month ago

Is your feature request related to a problem? Please describe.

When using HLS.js, I encountered a situation where calling hls.attachMedia(null) did not result in any error being logged to the console. This lack of feedback led to confusion and wasted time, as I spent two hours troubleshooting without clear guidance.

Describe the solution you'd like

It would be beneficial to improve error handling in HLS.js to provide more informative feedback when attachMedia is called with a null parameter. This could include logging an error message to the console indicating that a valid media element is required as a parameter.

Additional context

As a user of HLS.js, encountering unexpected behavior without adequate error reporting can be frustrating and time-consuming. Clearer error messages would greatly improve the developer experience and help users diagnose issues more efficiently.

robwalch commented 1 month ago

We'd accept a change that warns when attachMedia is passed a null or undefined media argument. Can you submit a PR?