http-streaming
http-streaming copied to clipboard
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.
Description
HLS streams with Opus audio tracks in fragmented MP4 weren't working in Chrome and Firefox due to reading the codec string as "Opus" with a capital "O", which MediaSource rejects.
Specific Changes proposed
Forcing the box name string to lowercase resolves the specific problem with Opus; all other known codec strings are lowercase. mux.js appears to use the same logic when returning codec strings, so this is not expected to be problematic.
Requirements Checklist
- [X] Feature implemented / Bug fixed
- [ ] If necessary, more likely in a feature request than a bug fix
- [ ] Unit Tests updated or fixed
- [ ] Docs/guides updated
- [ ] Example created (starter template on JSBin)
- [ ] Reviewed by Two Core Contributors
Codecov Report
Merging #1219 (7a4844f) into main (bdd842a) will not change coverage. The diff coverage is
100.00%
.
@@ Coverage Diff @@
## main #1219 +/- ##
=======================================
Coverage 85.40% 85.40%
=======================================
Files 40 40
Lines 9963 9963
Branches 2308 2308
=======================================
Hits 8509 8509
Misses 1454 1454
Impacted Files | Coverage Δ | |
---|---|---|
src/media-segment-request.js | 95.50% <100.00%> (ø) |
:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more