Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cast: MPEG2-TS media playlists fail load due to mux.js dependency check #5036

Closed
JulianDomingo opened this issue Feb 27, 2023 · 1 comment
Closed
Assignees
Labels
platform: Cast Issues affecting Cast devices priority: P1 Big impact or workaround impractical; resolve before feature release status: archived Archived and locked; will not be updated type: bug Something isn't working correctly
Milestone

Comments

@JulianDomingo
Copy link
Contributor

JulianDomingo commented Feb 27, 2023

Have you read the FAQ and checked for duplicate open issues?
Yes.

What version of Shaka Player are you using?
v4.3.3.

Can you reproduce the issue with our latest release version?
Yes.

Can you reproduce the issue with the latest code from main?
Yes.

Are you using the demo app or your own custom app?
Custom app.

If custom app, can you reproduce the issue using our demo app?
Yes.

What browser and OS are you using?
Chrome, 1.52.

For embedded devices (smart TVs, etc.), what model and firmware version are you using?
Google Nest Hub, 1.52.

What are the manifest and license server URIs?

TS media playlist: https://storage.googleapis.com/gtv-videos-bucket/hls/big_buck_bunny.m3u8
TS primary playlist (no issues): https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8

What configuration are you using? What is the output of player.getConfiguration()?

Default configuration.

What did you do?

  1. Load the TS media playlist.

What did you expect to happen?

  1. Loads successfully and starts playing the ocntent.

What actually happened?

  1. Loads unsuccessfully because it fails the dependency check for MuxJs.

Reason:
When any manifest is loaded, Shaka eventually calls MimeUtils#getFullOrConvertedType when it initializes the DRMEngine for the purposes of querying for media keys:

// We should get the decodingInfo results for the variants after we filling
// in the drm infos, and before queryMediaKeys_().
await shaka.util.StreamUtils.getDecodingInfosForVariants(variants,
this.usePersistentLicenses_, this.srcEquals_);
=>
const decodingConfigs = shaka.util.StreamUtils.getDecodingConfigs_(
=>
const audioFullType = shaka.util.MimeUtils.getFullOrConvertedType(

During this time, at least for HLS content, Shaka has yet to lazy-load the streams and therefore relies on a "best guess" to determine the mimeType for each streamInfo object, and is updated later:

const mimeType = this.guessMimeTypeBeforeLoading_(type, codecs) ||
this.guessMimeTypeFallback_(type);

For primary playlists, Shaka doesn't have enough information to correctly determine the stream uses MPEG2-TS (see above two methods, guessMimeTypeBeforeLoading_() and guessMimeTypeFallback_()). As a result, Shaka sets the mimeType to be mp4-based when it's not text streams. This also means the MimeUtils#getFullOrConvertedType are only supplied mp4 mimeTypes in this scenario. Lastly, this means TransmuxerEngine#isSupported() returns false, because Shaka Player doesn't initialize a default transmuxer plugin for mp4:

if (TransmuxerEngine.isSupported(fullMimeType, contentType)) {

For media playlists, Shaka does have enough information to determine it's MPEG2-TS, because it has access to the file extension of the media segments. Therefore, when MimeUtils#getFullOrConvertedType is called, it's passed video/mp2t as the mimeType => TransmuxeEngine#isSupported() returns true because a video/mp2t fallback plugin is registered by default => Shaka tries to instantiate the video/mp2t MuxJsTransmuxer: https://github.com/shaka-project/shaka-player/blob/main/lib/transmuxer/muxjs_transmuxer.js#L33-L38

However, Cast receiver applications have prevented loading of mux.js library since Shaka v3.1.0+, as Cast only used mux.js for purposes of CEA-608/708 captions (but is now natively supported in Shaka Player). As a result, the lines above throw a TypeError which ultimately fails the load of MPEG2-TS media playlists.

@JulianDomingo JulianDomingo added type: bug Something isn't working correctly platform: Cast Issues affecting Cast devices labels Feb 27, 2023
@JulianDomingo JulianDomingo added this to the v4.4 milestone Feb 27, 2023
@JulianDomingo JulianDomingo self-assigned this Feb 27, 2023
avelad added a commit that referenced this issue Feb 28, 2023
@avelad
Copy link
Member

avelad commented Feb 28, 2023

@JulianDomingo Can we close the issue with the merged PRs? Or is something more needed?

joeyparrish pushed a commit that referenced this issue Mar 1, 2023
joeyparrish pushed a commit that referenced this issue Mar 1, 2023
joeyparrish pushed a commit that referenced this issue Mar 1, 2023
joeyparrish pushed a commit that referenced this issue Mar 2, 2023
@avelad avelad closed this as completed Aug 23, 2023
@avelad avelad added the priority: P1 Big impact or workaround impractical; resolve before feature release label Aug 23, 2023
@shaka-bot shaka-bot added the status: archived Archived and locked; will not be updated label Oct 22, 2023
@shaka-project shaka-project locked as resolved and limited conversation to collaborators Oct 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
platform: Cast Issues affecting Cast devices priority: P1 Big impact or workaround impractical; resolve before feature release status: archived Archived and locked; will not be updated type: bug Something isn't working correctly
Projects
None yet
Development

No branches or pull requests

3 participants