demo ยท v138

Migration codemod

Paste real DASH/HLS player code that uses the deprecated asynchronous SourceBuffer.remove() — the kind that mutates updating, fires updatestart/updateend, and conflicts with concurrent appendBuffer calls — and the codemod rewrites it to the queue-driven shape MSE now expects.

Deprecation, not removal yet. Chrome 138 keeps async remove working but logs a console warning and a use-counter. Behaviour will change once the use-counter drops to a tiny percentage of all MSE traffic. Migrate now to avoid getting paged when it does.

before — deprecated async remove

after — queue + await

what the codemod does

  1. Replaces each sb.remove(start, end) with a helper, removeRange(sb, start, end), that returns a Promise.
  2. Wraps the outer function in async and awaits every remove and appendBuffer.
  3. Removes orphaned updateend listeners that exist purely to chain a follow-up remove.
  4. Inserts a top-of-file helper that serialises calls per SourceBuffer so two updates can never race.

see also