Browser Media Pipeline Deep Dive

The core innovation of a local-first browser player is skipping the network entirely. We do this via the URL.createObjectURL() API.

The File API Blob

When you select a file via an <input type="file">, the browser doesn't upload the file. It generates a File object, which is a specific type of Blob (Binary Large Object). This Blob represents the data on the disk, but it resides in a secure, sandboxed state governed by the browser.

Creating the Object URL

The magic happens when we call URL.createObjectURL(file). This instructs the browser engine to create a special, temporary, internal URL (e.g., blob:https://umediaplay.com/uuid) that maps directly to the file data on the local disk or in memory.

Native Media Elements

By assigning this blob URL to the src attribute of an HTML5 <video> tag, the browser's underlying C++ media engine takes over. It treats the local disk reference exactly as it would treat an HTTP stream, but with zero network latency. The browser buffers, parses headers, and decodes frames using OS-level APIs.

Memory Management

Because blob URLs tie up browser memory to maintain the reference, it's critical to call URL.revokeObjectURL() when the video is closed or changed. Failure to do so results in massive memory leaks when opening large 4K files consecutively.