Your screen. Your subscription. Your ProMax. Start with a one-day trial ↗

Pro Max 4K OTT

Why SourceBuffer appends need an orderly queue

A browser can finish downloading a media segment while its SourceBuffer is still processing an earlier operation.

What changes picture quality. The source, connection, player and display all need their own consideration. Pro Max 4K OTT, promax4k.tv.
What changes picture quality. The source, connection, player and display all need their own consideration. Pro Max 4K OTT, promax4k.tv.

A browser can finish downloading a media segment while its SourceBuffer is still processing an earlier operation. Media Source Extensions separates those activities. The updating flag and completion events let a player serialize operations on a buffer. Ignoring that lifecycle can produce a local InvalidStateError even when both HTTP downloads succeeded.

Follow two segments into one buffer

Imagine segments A and B complete their network requests almost together. The player calls appendBuffer(A), which begins an asynchronous append and sets updating to true. If the same buffer receives appendBuffer(B) before that operation has finished, the prepare-append rules reject the overlapping operation. Faster internet does not resolve the scheduling mistake; it may make the arrivals closer together.

Treat completion as an outcome to inspect

The update event indicates a successful append or removal, while updateend indicates that the operation ended. Error and abort paths can also lead to updateend. A player should therefore use completion to advance its operation queue while separately handling the result. Seeing updateend alone is not enough to assert that the supplied media was accepted successfully. Preserve the preceding event or error rather than hiding it behind a generic retry.

Include removal in the same reasoning

Removing an old time range is also an asynchronous buffer operation. A player that trims its buffer while downloading new segments needs to coordinate that removal with later appends. The rules concern the particular SourceBuffer object; they do not imply that every network transfer must run one at a time. Efficient fetching and orderly insertion into a media timeline are compatible design choices.

Make the evidence specific

A useful developer report pairs operation type, buffer identity, updating state, event order and a monotonic timestamp. A viewer can contribute the action that triggered the failure, such as a rapid channel change or seeking repeatedly. The error name alone has several possible causes, including a buffer already removed from its parent. Confirm the actual rejected condition before attributing every InvalidStateError to overlapping appends or advising a hardware replacement.

Sources & further reading

From the ProMax collection

A few details make setup easier.

Your device model, operating system and player edition. Keep those three details ready when you contact us.

Pro Max television interface with device, network and player preparation prompts for setup support.
Your device model, operating system and player edition. Keep those three details ready when you contact us.

An evening worth making time for

Get the player ready.
We’ll help with the rest.

Install the player for your screen, then WhatsApp the ProMax team for a one-day free trial. Already watching? Open the help desk for your next step.

Ask ProMax↑