diff options
| author | Christophe Besson <cbesson@gmail.com> | 2026-10-06 23:18:38 +0200 |
|---|---|---|
| committer | Christophe Besson <cbesson@gmail.com> | 2026-10-06 23:18:38 +0200 |
| commit | 0572bbde72514a9584b19fe031a03d4c9b23d74c (patch) | |
| tree | 389ea23aa646ffe7da56dd6e3fa30c9405fa0fd2 /packages/meshbay-hub/src/meshbay_hub/static/video-player.js | |
| parent | 92b7afcb186d7aaf475939d58a0385f408425eeb (diff) | |
| download | meshbay-0572bbde72514a9584b19fe031a03d4c9b23d74c.tar.gz | |
fix(hub): play video on iPhone through ManagedMediaSource
An iPhone has no MediaSource; every film was refused as an
unsupported codec. A browser with neither now says so.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-hub/src/meshbay_hub/static/video-player.js')
| -rw-r--r-- | packages/meshbay-hub/src/meshbay_hub/static/video-player.js | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/video-player.js b/packages/meshbay-hub/src/meshbay_hub/static/video-player.js index 21abe8e..5ea14ef 100644 --- a/packages/meshbay-hub/src/meshbay_hub/static/video-player.js +++ b/packages/meshbay-hub/src/meshbay_hub/static/video-player.js @@ -1104,7 +1104,16 @@ function VideoPlayer({ entry, transportRef, gekRef, onClose, onDownload, onCopyL setAudioTrack(msg.audio_track); } - if (!window.MediaSource || !MediaSource.isTypeSupported(mime)) { + // An iPhone has no MediaSource, only ManagedMediaSource (iOS 17.1+): + // testing for the first alone refused every film there, and blamed + // the codec for it. + const MS = window.MediaSource || window.ManagedMediaSource; + if (!MS) { + setError(t('video.err_no_mse')); + setPhase('error'); + return; + } + if (!MS.isTypeSupported(mime)) { setError(t('video.err_mse', { codec: msg.codec })); setPhase('error'); return; @@ -1186,7 +1195,7 @@ function VideoPlayer({ entry, transportRef, gekRef, onClose, onDownload, onCopyL castRestartPendingRef.current = true; } - const ms = new MediaSource(); + const ms = new MS(); msRef.current = ms; if (blobUrlRef.current) URL.revokeObjectURL(blobUrlRef.current); const url = URL.createObjectURL(ms); @@ -1235,6 +1244,9 @@ function VideoPlayer({ entry, transportRef, gekRef, onClose, onDownload, onCopyL }); if (videoRef.current) { + // A ManagedMediaSource never opens on an element AirPlay could take + // over, unless it is given a second source to hand AirPlay instead. + if (MS !== window.MediaSource) videoRef.current.disableRemotePlayback = true; videoRef.current.src = url; videoRef.current.addEventListener('seeking', onSeeking); videoRef.current.addEventListener('timeupdate', pump); |