Skip to content

Commit

Permalink
fix: Add support to file type in MediaCapabilities polyfill (#3569)
Browse files Browse the repository at this point in the history
Issue: #3530
  • Loading branch information
Álvaro Velad Galván committed Aug 10, 2021
1 parent 16c1810 commit c07d1a3
Showing 1 changed file with 33 additions and 12 deletions.
45 changes: 33 additions & 12 deletions lib/polyfill/media_capabilities.js
Expand Up @@ -63,21 +63,42 @@ shaka.polyfill.MediaCapabilities = class {
return res;
}

// Use 'MediaSource.isTypeSupported' to check if the stream is supported.
if (mediaDecodingConfig['video']) {
const contentType = mediaDecodingConfig['video'].contentType;
const isSupported = MediaSource.isTypeSupported(contentType);
if (!isSupported) {
return res;
if (mediaDecodingConfig.type == 'media-source') {
// Use 'MediaSource.isTypeSupported' to check if the stream is supported.
if (mediaDecodingConfig['video']) {
const contentType = mediaDecodingConfig['video'].contentType;
const isSupported = MediaSource.isTypeSupported(contentType);
if (!isSupported) {
return res;
}
}

if (mediaDecodingConfig['audio']) {
const contentType = mediaDecodingConfig['audio'].contentType;
const isSupported = MediaSource.isTypeSupported(contentType);
if (!isSupported) {
return res;
}
}
} else if (mediaDecodingConfig.type == 'file') {
if (mediaDecodingConfig['video']) {
const contentType = mediaDecodingConfig['video'].contentType;
const isSupported = shaka.util.Platform.supportsMediaType(contentType);
if (!isSupported) {
return res;
}
}
}

if (mediaDecodingConfig['audio']) {
const contentType = mediaDecodingConfig['audio'].contentType;
const isSupported = MediaSource.isTypeSupported(contentType);
if (!isSupported) {
return res;
if (mediaDecodingConfig['audio']) {
const contentType = mediaDecodingConfig['audio'].contentType;
const isSupported = shaka.util.Platform.supportsMediaType(contentType);
if (!isSupported) {
return res;
}
}
} else {
// Otherwise not supported.
return res;
}

if (!mediaDecodingConfig.keySystemConfiguration) {
Expand Down

0 comments on commit c07d1a3

Please sign in to comment.