Skip to content

Commit

Permalink
feat: Add TS transmuxer for muxed content (#5571)
Browse files Browse the repository at this point in the history
  • Loading branch information
avelad committed Sep 7, 2023
1 parent 5fa8b42 commit 7df3321
Show file tree
Hide file tree
Showing 40 changed files with 236 additions and 575 deletions.
10 changes: 3 additions & 7 deletions README.md
Expand Up @@ -132,8 +132,7 @@ HLS features supported:
blocking playlist reload
- Discontinuity
- ISO-BMFF / MP4 / CMAF support
- MPEG-2 TS support (transmuxing provided by [mux.js][] v6.2.0+, must be
separately included)
- MPEG-2 TS support
- WebVTT and TTML
- CEA-608/708 captions
- Encrypted content with PlayReady and Widevine
Expand All @@ -144,7 +143,6 @@ HLS features supported:
HLS features **not** supported:
- I-frame-only playlists: https://github.com/shaka-project/shaka-player/issues/742

[mux.js]: https://github.com/videojs/mux.js/releases

## MPEG-5 Part2 LCEVC Support

Expand Down Expand Up @@ -235,8 +233,7 @@ Shaka Player supports:
SegmentTemplate@index
- Not supported in HLS
- MPEG-2 TS
- With help from [mux.js][] v6.2.0+, can be played on any browser which
supports MP4
- Can be played on any browser which supports MP4
- Can find and parse timestamps to find segment start time in HLS
- WebVTT
- Supported in both text form and embedded in MP4
Expand Down Expand Up @@ -289,8 +286,7 @@ Shaka Player supports:
- MP3 in MPEG-2 TS to MP3 in MP4
- MP3 in MPEG-2 TS to raw MP3
- H.264 in MPEG-2 TS to H.264 in MP4
- Muxed AAC and H.264 in MPEG-2 TS to AAC and H.264 in MP4,
with help from [mux.js][] v6.2.0+
- Muxed content in MPEG-2 TS with the previous codecs


## Thumbnails support
Expand Down
1 change: 0 additions & 1 deletion build/types/transmuxer
Expand Up @@ -10,5 +10,4 @@
+../../lib/transmuxer/mp3_transmuxer.js
+../../lib/transmuxer/mpeg_audio.js
+../../lib/transmuxer/mpeg_ts_transmuxer.js
+../../lib/transmuxer/muxjs_transmuxer.js
+../../lib/transmuxer/ts_transmuxer.js
2 changes: 0 additions & 2 deletions demo/index.html
Expand Up @@ -36,8 +36,6 @@
<link rel="stylesheet" href="../dist/controls.css">

<script defer src="https://www.gstatic.com/cv/js/sender/v1/cast_sender.js"></script>
<!-- transmuxing support is enabled by including this: -->
<script defer src="../node_modules/mux.js/dist/mux.min.js"></script>
<!-- MSS support is enabled by including this: -->
<script defer src="../node_modules/codem-isoboxer/dist/iso_boxer.min.js"></script>
<!-- MPEG-5 Part2 LCEVC support is enabled by including this: -->
Expand Down
3 changes: 0 additions & 3 deletions demo/service_worker.js
Expand Up @@ -92,9 +92,6 @@ const OPTIONAL_RESOURCES = [
'https://shaka-player-demo.appspot.com/assets/poster.jpg',
'https://shaka-player-demo.appspot.com/assets/audioOnly.gif',

// The mux.js transmuxing library for MPEG-2 TS and CEA support.
'../node_modules/mux.js/dist/mux.min.js',

// The codem-isoboxer library for MSS support.
'../node_modules/codem-isoboxer/dist/iso_boxer.min.js',

Expand Down
14 changes: 0 additions & 14 deletions docs/tutorials/faq.md
Expand Up @@ -106,20 +106,6 @@ configure {@link shaka.extern.StreamingConfiguration|

<hr>

**Q:** Why doesn't my HLS content work?

**A:** If your HLS content uses MPEG2-TS, you may need to enable transmuxing.
The only browsers capable of playing TS natively are Edge and Chromecast. You
will get a `CONTENT_UNSUPPORTED_BY_BROWSER` error on other browsers due to
their lack of TS support.

You can enable transmuxing by [including mux.js][] v5.6.3+ in your application.
If Shaka Player detects that mux.js has been loaded, we will use it to transmux
TS content into MP4 on-the-fly, so that the content can be played by the
browser.

<hr>

**Q:** Why does it take so long to switch to HD?

**A:** When Shaka Player's `AbrManager` makes a decision to adapt, we don't
Expand Down
69 changes: 0 additions & 69 deletions externs/mux.js

This file was deleted.

6 changes: 3 additions & 3 deletions karma.conf.js
Expand Up @@ -191,9 +191,6 @@ module.exports = (config) => {
// Babel polyfill, required for async/await
'node_modules/@babel/polyfill/dist/polyfill.js',

// muxjs module next
'node_modules/mux.js/dist/mux.min.js',

// codem-isoboxer module next
'node_modules/codem-isoboxer/dist/iso_boxer.min.js',

Expand Down Expand Up @@ -247,6 +244,9 @@ module.exports = (config) => {
{pattern: 'test/test/assets/hls-ts-h264/*', included: false},
{pattern: 'test/test/assets/hls-ts-mp3/*', included: false},
{pattern: 'test/test/assets/hls-ts-muxed-aac-h264/*', included: false},
{pattern: 'test/test/assets/hls-ts-muxed-ac3-h264/*', included: false},
{pattern: 'test/test/assets/hls-ts-muxed-mp3-h264/*', included: false},
{pattern: 'test/test/assets/hls-ts-muxed-ec3-h264/*', included: false},
{pattern: 'dist/shaka-player.ui.js', included: false},
{pattern: 'dist/locales.js', included: false},
{pattern: 'demo/**/*.js', included: false},
Expand Down
15 changes: 8 additions & 7 deletions lib/dependencies/all.js
Expand Up @@ -6,6 +6,8 @@

goog.provide('shaka.dependencies');

goog.require('shaka.Deprecate');

/**
* @export
*/
Expand All @@ -22,6 +24,12 @@ shaka.dependencies = class {
if (!shaka.dependencies.Allowed[key]) {
throw new Error(`${key} is not supported`);
}
if (key == shaka.dependencies.Allowed.muxjs) {
shaka.Deprecate.deprecateFeature(5,
'mux.js',
'mux.js is no longer used in Shaka Player.');
return;
}
shaka.dependencies.dependencies_.set(key, () => dep);
}

Expand All @@ -36,12 +44,6 @@ shaka.dependencies = class {
return shaka.dependencies.dependencies_.has(key);
}

/** @return {?muxjs} */
static muxjs() {
return /** @type {?muxjs} */ (shaka.dependencies.dependencies_.get(
shaka.dependencies.Allowed.muxjs)());
}

/** @return {?ISOBoxer} */
static isoBoxer() {
return /** @type {?ISOBoxer} */ (shaka.dependencies.dependencies_.get(
Expand All @@ -65,6 +67,5 @@ shaka.dependencies.Allowed = {
* @private {!Map.<shaka.dependencies.Allowed, function():?>}
*/
shaka.dependencies.dependencies_ = new Map([
[shaka.dependencies.Allowed.muxjs, () => window.muxjs],
[shaka.dependencies.Allowed.ISOBoxer, () => window.ISOBoxer],
]);

0 comments on commit 7df3321

Please sign in to comment.