-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider ManagedSourceBuffer in MSE support detection #6846
base: master
Are you sure you want to change the base?
Conversation
Hi @niklaskorz,
In which versions of iOS are you able to reproduce this issue? I've been running HLS.js on iOS 17.1-18+ without this issue.
While correct, there are other platforms that do not expose Lines 20 to 24 in 3e77cb5
|
@robwalch I now realize I indeed misunderstood the purpose of the SourceBuffer check. It makes sense that needing to check for these functions on Managed MSE is not required in the first place, as the only (current) implementation of Managed MSE (WebKit) is feature-complete. I'll double check on Monday how I came upon this in the first place, sorry for the noise! |
@niklaskorz no worries. The changes make sense. I had to debug by connecting an iPhone to understand why it was working. I think we can take this change. I'll want to run them on the device too before giving a formal review. |
As for #6161, the simulator is another story. I don't use iOS simulators for media testing Problems with playback in simulators should be reported to Apple via Feedback Assistant. Maybe there's a change we should make (in addition to this one) that would help developers know that they should test on a real device (or a real bug that needs to be fixes for hls.js? - let me know if you identify any). |
function getSourceBuffer( | ||
preferManagedSourceBuffer = true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only place getSourceBuffer
is called is in this module by isMSESupported
. Adding the preferManagedSourceBuffer
argument is unnecessary, as it is never passed in. That argument is used by player instances calling getMediaSource
and not the static method isMSESupported
used to check for the presence of MSE or compatible Managed Media Source.
function getSourceBuffer( | ||
preferManagedSourceBuffer = true, | ||
): typeof self.SourceBuffer { | ||
const msb = | ||
(preferManagedSourceBuffer || !self.SourceBuffer) && | ||
((self as any).ManagedSourceBuffer as undefined | typeof self.SourceBuffer); | ||
return msb || self.SourceBuffer || (self as any).WebKitSourceBuffer; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd be willing to merge with the following change. See previous comment for reasoning:
function getSourceBuffer( | |
preferManagedSourceBuffer = true, | |
): typeof self.SourceBuffer { | |
const msb = | |
(preferManagedSourceBuffer || !self.SourceBuffer) && | |
((self as any).ManagedSourceBuffer as undefined | typeof self.SourceBuffer); | |
return msb || self.SourceBuffer || (self as any).WebKitSourceBuffer; | |
function getSourceBuffer(): typeof self.SourceBuffer { | |
return self.SourceBuffer || (self as any).ManagedSourceBuffer || (self as any).WebKitSourceBuffer; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@niklaskorz would you be willing to make the requested changes?
This PR will...
Consider
ManagedSourceBuffer
as well when detecting MSE support.Why is this Pull Request needed?
On iOS Safari,
isMSESupported()
, and thusisSupported()
, will currently always returnfalse
as the prototype checks onSourceBuffer
fail, becauseself.SourceBuffer
(andself.WebKitSourceBuffer
) does not exist on iOS Safari.Are there any points in the code the reviewer needs to double check?
The change is rather simple, so no.
Resolves issues:
No issue has been reported in this regard, but #6161 might be related.
Checklist
isSupported()
to begin withgetSourceBuffer
is not exported)