Skip to content

Commit

Permalink
Consider ManagedSourceBuffer in MSE support detection
Browse files Browse the repository at this point in the history
  • Loading branch information
niklaskorz committed Nov 15, 2024
1 parent a885a74 commit 3e77cb5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/is-supported.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@ import { mimeTypeForCodec } from './utils/codecs';
import { getMediaSource } from './utils/mediasource-helper';
import type { ExtendedSourceBuffer } from './types/buffer';

function getSourceBuffer(): typeof self.SourceBuffer {
return self.SourceBuffer || (self as any).WebKitSourceBuffer;
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;
}

export function isMSESupported(): boolean {
Expand Down

0 comments on commit 3e77cb5

Please sign in to comment.