Skip to content

Commit

Permalink
fix: playlists wrongfully excluded on iOS when using ManagedMediaSour…
Browse files Browse the repository at this point in the history
…ce (#1555)
  • Loading branch information
alex-barstow authored Nov 27, 2024
1 parent 390cdfd commit 3c4bbf1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/playlist-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ export class PlaylistController extends videojs.EventTarget {
this.playlistExclusionDuration = playlistExclusionDuration;
this.maxPlaylistRetries = maxPlaylistRetries;
this.enableLowInitialPlaylist = enableLowInitialPlaylist;
this.usingManagedMediaSource_ = false;

if (this.useCueTags_) {
this.cueTagsTrack_ = this.tech_.addTextTrack(
Expand All @@ -221,6 +222,7 @@ export class PlaylistController extends videojs.EventTarget {
// Airplay source not yet implemented. Remote playback must be disabled.
this.tech_.el_.disableRemotePlayback = true;
this.mediaSource = new window.ManagedMediaSource();
this.usingManagedMediaSource_ = true;

videojs.log('Using ManagedMediaSource');
} else if (window.MediaSource) {
Expand Down Expand Up @@ -1997,7 +1999,7 @@ export class PlaylistController extends videojs.EventTarget {
}

// fmp4 relies on browser support, while ts relies on muxer support
const supportFunction = (isFmp4, codec) => (isFmp4 ? browserSupportsCodec(codec) : muxerSupportsCodec(codec));
const supportFunction = (isFmp4, codec) => (isFmp4 ? browserSupportsCodec(codec, this.usingManagedMediaSource_) : muxerSupportsCodec(codec));
const unsupportedCodecs = {};
let unsupportedAudio;

Expand Down Expand Up @@ -2139,11 +2141,11 @@ export class PlaylistController extends videojs.EventTarget {
const codecs = codecsForPlaylist(this.main, variant);
const unsupported = [];

if (codecs.audio && !muxerSupportsCodec(codecs.audio) && !browserSupportsCodec(codecs.audio)) {
if (codecs.audio && !muxerSupportsCodec(codecs.audio) && !browserSupportsCodec(codecs.audio, this.usingManagedMediaSource_)) {
unsupported.push(`audio codec ${codecs.audio}`);
}

if (codecs.video && !muxerSupportsCodec(codecs.video) && !browserSupportsCodec(codecs.video)) {
if (codecs.video && !muxerSupportsCodec(codecs.video) && !browserSupportsCodec(codecs.video, this.usingManagedMediaSource_)) {
unsupported.push(`video codec ${codecs.video}`);
}

Expand Down

0 comments on commit 3c4bbf1

Please sign in to comment.