aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/src/meshbay_hub/static/video-player.js
diff options
context:
space:
mode:
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.js16
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);