From 1dcb9fb5e22b9bd8b14b290bad38a7844f444576 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 3 Nov 2021 11:41:57 -0700 Subject: [PATCH] Fix for Opus audio in fragmented MP4 The Opus box name is capitalized, but MediaSource expects a lowercase "opus" codec string, which was causing unexpected failures in Chrome and Firefox. Now matches behavior of mux.js for audio tracks by forcing the box type to lowercase before returning it as a codec string. --- src/media-segment-request.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/media-segment-request.js b/src/media-segment-request.js index d6c91051e..efb316a10 100644 --- a/src/media-segment-request.js +++ b/src/media-segment-request.js @@ -440,7 +440,8 @@ const handleSegmentBytes = ({ // if we have a audio track, with a codec that is not set to // encrypted audio if (tracks.audio && tracks.audio.codec && tracks.audio.codec !== 'enca') { - trackInfo.audioCodec = tracks.audio.codec; + // note Opus box name is capitalized, but things want lowercase for checks + trackInfo.audioCodec = tracks.audio.codec.toLowerCase(); } // if we have a video track, with a codec that is not set to