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
- Replaces each
sb.remove(start, end)with a helper,removeRange(sb, start, end), that returns a Promise. - Wraps the outer function in
asyncandawaits everyremoveandappendBuffer. - Removes orphaned
updateendlisteners that exist purely to chain a follow-up remove. - Inserts a top-of-file helper that serialises calls per SourceBuffer so two updates can never race.