Closed stevenking888 closed 1 month ago
There is isSupported
method in Hls.js that should do the checks.
@stevenking888 In case Hls.isSupported() doesn't solve your problem, please provide the following details:
I found an problem with some Safari browser on some Apple device. (The most case error in hls.js debug log is can't decode but when I'm not use P2P no problem with the same playlis) So I think is it possible to add 'isSupported' method and on error event listener to switch to normal HLS without P2P.
I try to add 'isP2PDisabled: true' when error happended but seem to not solve.
Can we share some idea for handle this situation ?
I use mac xcode Simulator test,even if ios version > 17.1.1,can not use ManagedMediaSource api play video,but use Real machine debugger can play video,so i use js check it.
hls.js Hls.isSupported() Inaccurate judgment dash.js dashjs.supportsMediaSource() Inaccurate judgment shaka.Player.isBrowserSupported() Inaccurate judgment
Accurate judgment:
if (shaka.Player.isBrowserSupported()) {
let supportFlag = false;
const mediaType = 'video/mp4; codecs="mp4a.40.2,avc1.4d4015"';
if ("ManagedMediaSource" in window && ManagedMediaSource.isTypeSupported(mediaType)) supportFlag = true;
if ("MediaSource" in window && MediaSource.isTypeSupported(mediaType)) supportFlag = true;
if (!supportFlag) {
video.src = url;
return;
}
const player = new shaka.Player();
player.configure({
streaming: {
// bufferingGoal: 120
}
});
await player.attach(video);
// Try to load a manifest.
// This is an asynchronous process.
try {
await player.load(url);
} catch (e) {
// onError is executed if the asynchronous load fails.
console.log(e);
}
} else if (video.canPlayType('application/vnd.apple.mpegurl')) {
video.src = url;
}
There is a bug in the iPhone simulator. It doesn't support required MMS (it is how MSE is called on iOS) feature/codecs for Hls.js to run. Do test/development on iPad simulator or real iOS device.
Xcode was recently updated, and we will test if the issue with MMS in the iPhone simulator is fixed there.
MMS is fixed and works in iOS 18 simulators:
I found problem only on Mac Safari. When play a while (not over 5 minute) double tested with multiple Mac devices
Mac pass these condtions
window.MediaSource !== 'undefined' window.WebKitMediaSource !== 'undefined'; RTCPeerConnection !== 'undefined' webkitRTCPeerConnection !== 'undefined' mozRTCPeerConnection !== 'undefined'
We can't reproduce the issue with Safari. All the videos play for us for over 5 minutes on Safari. Is the problem reproducible with our demo?
I found an problem with some Safari browser on some Apple device. (The most case error in hls.js debug log is can't decode but when I'm not use P2P no problem with the same playlis) So I think is it possible to add 'isSupported' method and on error event listener to switch to normal HLS without P2P.
I try to add 'isP2PDisabled: true' when error happended but seem to not solve.
Can we share some idea for handle this situation ?