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

Clear error code needed for bad MIME type in addTextTrack #1782

Closed
kevinscroggins-youi opened this issue Jan 28, 2019 · 9 comments · Fixed by #3110
Closed

Clear error code needed for bad MIME type in addTextTrack #1782

kevinscroggins-youi opened this issue Jan 28, 2019 · 9 comments · Fixed by #3110
Labels
component: captions/subtitles The issue involves captions or subtitles status: archived Archived and locked; will not be updated type: enhancement New feature or request
Milestone

Comments

@kevinscroggins-youi
Copy link

kevinscroggins-youi commented Jan 28, 2019

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

What version of Shaka Player are you using?
2.4.6

Can you reproduce the issue with our latest release version?
Yes, 2.5.0-beta2 as well

Can you reproduce the issue with the latest code from master?
Yes

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

If custom app, can you reproduce the issue using our demo app?
No, since you can't load an external text track from file.

What browser and OS are you using?
Tizen Emulator and Google Chrome 71 on OSX 10.13.6

For embedded devices (smart TVs, etc.), what model and firmware version are you using?
Tizen Emulator with 4.0 Web Platform currently, but not strictly limited to this platform.

What are the manifest and license server URIs?

What did you do?

Tried to add an external WebVTT2 text track after the video successfully loads.

Fiddle: https://jsfiddle.net/8Lu0trec

What did you expect to happen?
I expected the text track to load successfully and have the player report that there is one text track when queried.

What actually happened?

The WebVTT2 external text track file failed to load and three different unexpected errors appeared in the console, including a crash. Not sure if WebVTT2 is unsupported or if there's a different issue here, but the error handling / data validation seems to be failing in any case.

EDIT: According to the documentation, this function is supposed to be called in the resolve() promise of the player.load() function, so hopefully I have it implemented correctly?

Console output:

VM85 shaka-player.compiled.debug.js:962 InputEvent.install
VM85 shaka-player.compiled.debug.js:963 mathRound.install
VM85 shaka-player.compiled.debug.js:964 MediaSource.install
VM85 shaka-player.compiled.debug.js:965 Using native MSE as-is.
VM85 shaka-player.compiled.debug.js:1040 VideoPlayPromise.install
VM85 shaka-player.compiled.debug.js:1042 Using native VTTCue.
VM85 shaka-player.compiled.debug.js:822 Unload latency: 0.022
VM85 shaka-player.compiled.debug.js:512 No Period ID given for Period with start time 0,  Assigning a default
VM85 shaka-player.compiled.debug.js:264 Dropping Variant (not compatible with key system, platform, or active Variant) {id: 32, language: "en", primary: true, audio: {…}, video: {…}, …}
VM85 shaka-player.compiled.debug.js:264 Dropping Variant (not compatible with key system, platform, or active Variant) {id: 33, language: "en", primary: true, audio: {…}, video: {…}, …}
VM85 shaka-player.compiled.debug.js:264 Dropping Variant (not compatible with key system, platform, or active Variant) {id: 34, language: "en", primary: true, audio: {…}, video: {…}, …}
VM85 shaka-player.compiled.debug.js:264 Dropping Variant (not compatible with key system, platform, or active Variant) {id: 35, language: "en", primary: true, audio: {…}, video: {…}, …}
VM85 shaka-player.compiled.debug.js:264 Dropping Variant (not compatible with key system, platform, or active Variant) {id: 36, language: "en", primary: true, audio: {…}, video: {…}, …}
VM85 shaka-player.compiled.debug.js:264 Dropping Variant (not compatible with key system, platform, or active Variant) {id: 37, language: "en", primary: true, audio: {…}, video: {…}, …}
VM85 shaka-player.compiled.debug.js:264 Dropping Variant (not compatible with key system, platform, or active Variant) {id: 38, language: "en", primary: true, audio: {…}, video: {…}, …}
VM85 shaka-player.compiled.debug.js:264 Dropping Variant (not compatible with key system, platform, or active Variant) {id: 39, language: "en", primary: true, audio: {…}, video: {…}, …}
VM85 shaka-player.compiled.debug.js:818 Found variant with audio and video content, so filtering out audio-only content in all periods.
VM85 shaka-player.compiled.debug.js:830 codecs avc1-mp4a avg bandwidth 3006026.75
VM85 shaka-player.compiled.debug.js:904 onChooseStreams_ {startTime: 0, textStreams: Array(0), variants: Array(16)}
VM85 shaka-player.compiled.debug.js:904 Choosing new streams after period changed
VM85 shaka-player.compiled.debug.js:657 init: completed initial Stream setup
VM85 shaka-player.compiled.debug.js:236 Assertion failed: Type negotiation should happen before MediaSourceEngine.init!
(anonymous) @ VM85 shaka-player.compiled.debug.js:236
Promise.then (async)
shaka.media.MediaSourceEngine.init @ VM85 shaka-player.compiled.debug.js:236
shaka.media.StreamingEngine.loadNewTextStream @ VM85 shaka-player.compiled.debug.js:661
shaka.Player.addTextTrack @ VM85 shaka-player.compiled.debug.js:874
onVideoLoaded @ (index):69
Promise.then (async)
(anonymous) @ (index):66
window.onload @ (index):86
load (async)
(anonymous) @ (index):31
VM85 shaka-player.compiled.debug.js:222 Assertion failed: Text type negotiation should have happened already
shaka.text.TextEngine.initParser @ VM85 shaka-player.compiled.debug.js:222
shaka.media.MediaSourceEngine.reinitText @ VM85 shaka-player.compiled.debug.js:238
(anonymous) @ VM85 shaka-player.compiled.debug.js:236
Promise.then (async)
shaka.media.MediaSourceEngine.init @ VM85 shaka-player.compiled.debug.js:236
shaka.media.StreamingEngine.loadNewTextStream @ VM85 shaka-player.compiled.debug.js:661
shaka.Player.addTextTrack @ VM85 shaka-player.compiled.debug.js:874
onVideoLoaded @ (index):69
Promise.then (async)
(anonymous) @ (index):66
window.onload @ (index):86
load (async)
(anonymous) @ (index):31
(index):81 TypeError: a is not a constructor
    at shaka.text.TextEngine.initParser (VM85 shaka-player.compiled.debug.js:222)
    at shaka.media.MediaSourceEngine.reinitText (VM85 shaka-player.compiled.debug.js:238)
    at VM85 shaka-player.compiled.debug.js:236
onAddExternalTextTrackError @ (index):81
Promise.catch (async)
onVideoLoaded @ (index):80
Promise.then (async)
(anonymous) @ (index):66
window.onload @ (index):86
load (async)
(anonymous) @ (index):31```
@kevinscroggins-youi
Copy link
Author

After some more troubleshooting, it looks like I had the incorrect mime type, text/vtt seems to result in the text track loading correctly. Still seems like there might need to be some extra error handling / validation checks for this though?

@michellezhuogg
Copy link
Contributor

Hello @kevinscroggins-youi , we don't have access to your content. Do you have it whitelisted?

@michellezhuogg michellezhuogg added the status: waiting on response Waiting on a response from the reporter(s) of the issue label Jan 31, 2019
@kevinscroggins-youi
Copy link
Author

That's very strange, I don't believe there's any sort of whitelisting. Tried it on a VPN to make sure. The VTT file doesn't actually match the video, so any video asset and closed caption file can be used in its place if that helps. The main issue is that if the mime type is incorrect, there doesn't seem to be any sort of informative error handling. Hope this helps.

@shaka-bot shaka-bot removed the status: waiting on response Waiting on a response from the reporter(s) of the issue label Feb 1, 2019
@vaage
Copy link
Contributor

vaage commented Feb 4, 2019

@kevinscroggins-youi thank you again for providing an example via JSFiddle.

The source of your problem is that you are using "text/webvtt" but our parse is registered under "text/vtt". If you change the mime type to "text/vtt" it works (edited JSFiddle).

Once you have a chance to verify it, please feel free to close the issue.

@vaage vaage added type: question A question from the community and removed needs triage labels Feb 4, 2019
@joeyparrish
Copy link
Member

In my opinion, if there's not a clear error code for this, we should add one. addTextTrack returns a Promise, so that Promise could be rejected with a shaka.util.Error object with an unambiguous error code.

I suggest adding error code UNKNOWN_TEXT_MIME_TYPE, value 2010, with data[0] being the MIME type in question. This would use existing error category TEXT, value 2, and the severity would be RECOVERABLE, since playback could still continue.

@joeyparrish joeyparrish added type: enhancement New feature or request and removed type: question A question from the community labels Feb 4, 2019
@joeyparrish joeyparrish changed the title Cannot add external WebVTT2 text track from URI Clear error code needed for bad MIME type in addTextTrack Feb 4, 2019
@shaka-bot shaka-bot added this to the Backlog milestone Feb 4, 2019
@kevinscroggins-youi
Copy link
Author

@vaage No problem! And yes I'm aware of the mime issue, I discovered that shortly after and left a follow up comment that you might have missed. It does indeed work with the correct mime type of text/vtt, but the error handling for incorrect mime types seems to be missing based on the errors I was seeing.

@joeyparrish That sounds perfect!

@avelad
Copy link
Collaborator

avelad commented Jan 19, 2021

With the latest changes there are already error codes in addTextTrack and addTextTrackAsync

@TheModMaker
Copy link
Contributor

There are some error codes, but if you pass a random MIME argument, it will still add the track and fail later.

@avelad
Copy link
Collaborator

avelad commented Jan 20, 2021

I created #3110 to resolve it

@joeyparrish joeyparrish modified the milestones: Backlog, v3.1 Feb 11, 2021
@shaka-project shaka-project locked and limited conversation to collaborators Mar 21, 2021
@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
component: captions/subtitles The issue involves captions or subtitles status: archived Archived and locked; will not be updated type: enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants