Skip to content
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

Validate the existence of MediaSource before check MediaSource.isTypeSupported in MediaCapabilities polyfill #3225

Closed
wants to merge 1 commit into from

Conversation

avelad
Copy link
Member

@avelad avelad commented Mar 15, 2021

Issue #1391

@avelad
Copy link
Member Author

avelad commented Mar 15, 2021

@michellezhuogg

@michellezhuogg
Copy link
Contributor

Hello @avelad ,

Thank you for catching this!
If window.MediaSource doesn't exist, are we returning the wrong decodingInfo result? It may seem like the variant is not supported, but actually it's because of MediaSource is not there.
Shall we make sure that window.MediaSource exists before installing the MediaCapabilities polyfill?

@@ -54,15 +54,17 @@ shaka.polyfill.MediaCapabilities = class {
// Use 'MediaSource.isTypeSupported' to check if the stream is supported.
if (mediaDecodingConfig['video']) {
const contentType = mediaDecodingConfig['video'].contentType;
const isSupported = MediaSource.isTypeSupported(contentType);
const isSupported =
window.MediaSource && MediaSource.isTypeSupported(contentType);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see. Could this occur on iOS, since there's no MediaSource there?

Although this would fix an exception being thrown when MediaSource is not available, your solution would call all content unsupported on such a platform. Why would that be okay?

@avelad
Copy link
Member Author

avelad commented Mar 15, 2021

iOS actually supports Media Capabilities, but it doesn't support MediaSource. Since this case is rare and can only happen on some TVs, I think we can live with this, because on those TVs we would only use the src = mode.

If this convinces you too, I close this PR.

@michellezhuogg
Copy link
Contributor

I can add a log for this case, and we can close the PR. Thank you!

@avelad avelad closed this Mar 15, 2021
@avelad avelad deleted the media-source-media-cap branch March 15, 2021 18:43
@github-actions github-actions bot added the status: archived Archived and locked; will not be updated label Jul 25, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: archived Archived and locked; will not be updated
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants