Skip to content

feat(sia-video-source): iPhone MSE implementation support and device-too-old reporting - #1201

Merged
pcfreak30 merged 2 commits into
developfrom
feat/sia-video-source-iphone-mse-support
Sep 24, 2026
Merged

pcfreak30 merged 2 commits into
developfrom
feat/sia-video-source-iphone-mse-support

Conversation

@pcfreak30

@pcfreak30 pcfreak30 commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

Adds mse-runtime.ts, a probe that resolves the runtime MediaSource variant in preference order: standard MediaSource, then ManagedMediaSource (iPhone Safari 17.1+), then the legacy prefixed WebKitMediaSource, else none.

Managed (MMS) runtimes now work end to end: worker-mode MSE constructs an MMS when canConstructInDedicatedWorker allows, and the element gets disableRemotePlayback = true before every src/srcObject attach — required or sourceopen never fires. startstreaming/endstreaming are wired as diagnostics only.

Runtimes with no usable MSE (iPhone Safari pre-17.1, WebKit-prefix-only) fail fast with a new device wire kind that maps to MEDIA_ERR_SRC_NOT_SUPPORTED with an update-your-device message, surfaced through the existing v10 error getter/event.

PlaybackCapabilities gains mseImpl(); mseSupported() now consults the resolved implementation. ADR 0010 documents the matrix and the non-goal of a legacy-prefix playback path.


Overview

This PR adds iPhone Safari MSE support and introduces a dedicated device error for runtimes that cannot play Sia video at all.

What changed

  • MSE implementation detection layer: New capability module resolves the runtime’s MSE surface in a fixed order — standard MediaSource, then ManagedMediaSource, then legacy WebKitMediaSource, else none.

    • Standard MediaSource is preferred when both standard and managed exist.
    • ManagedMediaSource is the only MSE available on iPhone Safari 17.1+ and is now used as a supported playback path.
    • WebKitMediaSource is detect-only and treated as “device too old”.
    • Runtimes with no MSE surface are reported as none.
  • New device error kind: Added to the wire protocol, error mapper, and host playback machine. It maps to MEDIA_ERR_SRC_NOT_SUPPORTED (4) with a message directing users to iOS 17.1+ or a recent desktop browser.

  • Fail-fast device gating: Both the session coordinator and the host now reject loads with a device error (no-mse) before any worker roundtrip, source creation, or pipeline run when the runtime has no usable MSE.

  • ManagedMediaSource element preparation: Before attaching any MSE source — including a worker-transferred handle — the host sets disableRemotePlayback = true, which is required for ManagedMediaSource to fire sourceopen. startstreaming/endstreaming events are registered as diagnostics only.

  • Consistent capability resolution: MIME support probing, worker-MSE capability detection, worker MediaSource construction, and host main-thread MediaSource construction all now use the resolved MSE implementation instead of referencing the raw MediaSource global. This lets MMS-only runtimes report real MIME support and enables worker-mode playback on runtimes whose managed constructor supports it.

  • Tests, docs, and ADR: Added unit tests for MSE runtime detection/resolution, updated existing capability/session tests, documented the browser support matrix in the README, and added a decision record explaining the MSE implementation matrix and device-too-old handling.

Review finding

An automated review flags one issue: in session-coordinator.ts, the device-too-old gate rejects only the none MSE implementation, so webkit-legacy runtimes pass the gate and end up on the legacy detection path instead of reporting the intended device error.

…too-old reporting

Adds an MSE implementation probe (mse-runtime.ts) that resolves the runtime
MediaSource variant: standard, ManagedMediaSource (iPhone Safari 17.1+),
legacy WebKitMediaSource prefix, or none.

Managed runtimes construct an MMS in the worker when allowed, and the element
gets disableRemotePlayback = true before every src/srcObject attach, as Safari
requires for sourceopen. startstreaming/endstreaming forward as diagnostics.

Runtimes with no usable MSE fail fast through a new device wire kind that maps
to MEDIA_ERR_SRC_NOT_SUPPORTED with an update-your-device message on the v10
error channel. PlaybackCapabilities gains mseImpl() and mseSupported consults
the resolved implementation. ADR 0010 documents the matrix.
@kody-ai

This comment has been minimized.

Comment thread libs/sia-video-source/src/session/session-coordinator.ts Outdated
@kody-ai

kody-ai Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Kody Review Complete

Great news! 🎉
No issues were found that match your current review configurations.

Keep up the excellent work! 🚀

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the @kody start-review command at the root of your PR.

  • Validate Business Logic: Ask Kody to validate your code against business rules by adding a comment with the @kody -v business-logic command.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ✅

Access your configuration settings here.

​

@pcfreak30
pcfreak30 marked this pull request as ready for review September 24, 2026 21:32
@pcfreak30
pcfreak30 merged commit bf518c1 into develop Sep 24, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant