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

Can't handle text streams with different mimeTypes #571

Closed
sanbornhilland opened this issue Nov 1, 2016 · 4 comments
Closed

Can't handle text streams with different mimeTypes #571

sanbornhilland opened this issue Nov 1, 2016 · 4 comments
Assignees
Labels
status: archived Archived and locked; will not be updated type: bug Something isn't working correctly
Milestone

Comments

@sanbornhilland
Copy link
Contributor

Reproducible using Shaka v2.0.0-debug. (Commit #6f47acf688 currently 1 commit behind)

(1) Load content that contains MP4 embedded TTML
<AdaptationSet group="3" contentType="text" lang="en" minBandwidth="1000" maxBandwidth="1000" mimeType="application/mp4" codecs="stpp">
(2) Side load a web/vtt text track:
shakaPlayer.addTextTrack(trackUrl, 'eng', 'caption', 'text/vtt');

Expected:
Two text tracks should be available.

Result:
Bad Encoding (2004) error.

It appears that when the vtt track is not loaded then then the text track listed in the manifest is parsed using the Mp4TtmlParser and there are no errors. However when the the vtt track is sideloaded then a new parser is set in the TextEngine (line 38). When it comes time then to parse the TTML track, the TextEngine attempts to parse the track using the VttTextParser and it fails.

I'm not sure I can distribute the content that I used to reproduce this but I'll try to provide some content ASAP.

@sanbornhilland
Copy link
Contributor Author

This is reproducible in the shaka demo app using this content:

https://dtvn-vod-sponsored.akamaized.net/ss/vol2/s/AEG_CP/ifcf0180800000004087/2016-10-04-09-14-50/IFCF0280800000004087/output_mobile_dash.ism/index.mpd

It's protected so just plug in a dummy url for license url. This will get your far enough to reproduce the issue.

To trigger this issue you can side load any vtt track

player.addTextTrack('http://storage.googleapis.com/shaka-demo-assets/angel-one/s-en.webvtt', 'eng', 'caption', 'text/vtt');

@joeyparrish joeyparrish added the type: bug Something isn't working correctly label Nov 1, 2016
@joeyparrish joeyparrish added this to the v2.1.0 milestone Nov 1, 2016
@joeyparrish
Copy link
Member

I haven't debugged at all, but I believe this is a bug. It's caused by the fact that StreamingEngine treats text the same as any other track type.

For audio and video, it is not legal to change containers or codecs. MediaSource would have to be torn down for that, and in order to maintain seamless playback, we never tear down MediaSource within one presentation.

Text, on the other hand, is not handled by MediaSource in our player. So we could change text parsers on-the-fly when changing text tracks. StreamingEngine treats it like audio or video, though, and feeds the side-loaded text track to the text parser it already initialized.

We'll try to address this in v2.1, but side-loaded text is a low priority right now, so it might slip.

@joeyparrish joeyparrish self-assigned this Nov 16, 2016
@avelad
Copy link
Member

avelad commented Nov 30, 2016

I think that it's not working on master branch.

I tested with mpd with stpp subtitles and external track webvtt.

With:

player.load(asset.manifestUri, parseInt(position)).then(function() {
        (asset.extraText || []).forEach(function(extraText) {
          player.addTextTrack(extraText.uri, extraText.language, extraText.kind,
                              extraText.mime, extraText.codecs)
        })
      }, function(reason) {

I can not see the subtitles and in the console I see "{category: 2, code: 2004, data: Array[0]} TEXT --> BAD_ENCODING 2004"

and adding a timeout:

player.load(asset.manifestUri, parseInt(position)).then(function() {
        setTimeout(function() {
          (asset.extraText || []).forEach(function(extraText) {
            player.addTextTrack(extraText.uri, extraText.language, extraText.kind,
                                extraText.mime, extraText.codecs)
          })
        }, 1000)
      }, function(reason) {

I can see the subtitles but in console I see: "Uncaught (in promise) r {category: 3, code: 3015, data: Array[1]}"

@joeyparrish
Copy link
Member

BAD_ENCODING means that the UTF-8 decode in shaka.util.StringUtils.fromUTF8 failed. This indicates malformed text content. If the text content is not malformed, please file a new issue and provide a sample and steps to reproduce the error.

Error 3015 is MEDIA_SOURCE_OPERATION_THREW, which is unrelated to text. This indicates that the browser had a problem with your audio or video. If you think this is not right, please file a new issue and provide a sample and steps to reproduce the error.

@shaka-project shaka-project locked and limited conversation to collaborators Mar 22, 2018
@shaka-bot shaka-bot added the status: archived Archived and locked; will not be updated label Apr 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
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

4 participants