Skip to content

Commit

Permalink
feat: Add support for changing codecs in MediaSourceEngine (shaka-pro…
Browse files Browse the repository at this point in the history
…ject#5217)

Thanks to shaka-project#4766

This PR adds support for codec hot-switching in MediaSourceEngine. 
There are two ways to change codec:
- Using `Sourcebuffer.changeType` on supported browsers 
- Reloading the `MediaSource` instance with the new codecs

This change does not change the current filter logic, so this code is
not used yet. The change in the filtering will be done in a subsequent
PR in order to simplify the changes of this PR.
  • Loading branch information
avelad committed May 11, 2023
1 parent fa041d7 commit 464f33c
Show file tree
Hide file tree
Showing 6 changed files with 365 additions and 74 deletions.
10 changes: 10 additions & 0 deletions lib/media/media_source_capabilities.js
Expand Up @@ -27,6 +27,16 @@ shaka.media.Capabilities = class {
supportMap.set(type, currentSupport);
return currentSupport;
}

/**
* Determine support for SourceBuffer.changeType
* @return {boolean}
*/
static isChangeTypeSupported() {
return !!window.SourceBuffer &&
// eslint-disable-next-line no-restricted-syntax
!!SourceBuffer.prototype && !!SourceBuffer.prototype.changeType;
}
};

/**
Expand Down

0 comments on commit 464f33c

Please sign in to comment.