video-dev/hls.js ? reverse-engineered prompt

Reverse engineered prompt

I want to build a JavaScript library for playing HLS video streams on the web. It should work on top of a standard HTML <video> tag to provide HLS playback in browsers that don't support it natively, using MediaSource Extensions.

The most important feature is adaptive bitrate streaming, so it can automatically switch quality levels based on the user's network conditions. It needs to support both live streaming (with DVR capabilities) and video on demand (VOD). It should also support common features like WebVTT subtitles, closed captions, and the ability to select alternate audio tracks. Please include support for basic encrypted streams and common DRM systems like Widevine.

Let's write this in TypeScript and make sure it has good error recovery, so it can retry if there are network issues. Finally, please create a simple demo page where I can plug in an HLS stream URL and see the player in action.

Are you gonna build this?

make sure you review the code using coderabbit

Try freeSponsored — opens CodeRabbit in a new tab