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

SubtitleDecoderException appears to prevent the video from starting #6885

Closed
casolorz opened this issue Jan 17, 2020 · 6 comments
Closed

SubtitleDecoderException appears to prevent the video from starting #6885

casolorz opened this issue Jan 17, 2020 · 6 comments
Assignees
Labels

Comments

@casolorz
Copy link

I'm using ExoPlayer 2.10.8. When I set a bad subtitle, playback fails. Is there a way to make subtitles not do that? Exception below.

Also, is it possible to set subtitles on the fly without restarting the player?

Thanks.

E/ExoPlayerImplInternal: Playback error.
    com.google.android.exoplayer2.ExoPlaybackException: com.google.android.exoplayer2.text.SubtitleDecoderException: com.google.android.exoplayer2.ParserException: Expected WEBVTT. Got   <!DOCTYPE html>
        at com.google.android.exoplayer2.text.TextRenderer.render(TextRenderer.java:171)
        at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:575)
        at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:326)
        at android.os.Handler.dispatchMessage(Handler.java:98)
        at android.os.Looper.loop(Looper.java:154)
        at android.os.HandlerThread.run(HandlerThread.java:61)
     Caused by: com.google.android.exoplayer2.text.SubtitleDecoderException: com.google.android.exoplayer2.ParserException: Expected WEBVTT. Got   <!DOCTYPE html>
        at com.google.android.exoplayer2.text.webvtt.WebvttDecoder.decode(WebvttDecoder.java:69)
        at com.google.android.exoplayer2.text.webvtt.WebvttDecoder.decode(WebvttDecoder.java:31)
        at com.google.android.exoplayer2.text.SimpleSubtitleDecoder.decode(SimpleSubtitleDecoder.java:78)
        at com.google.android.exoplayer2.text.SimpleSubtitleDecoder.decode(SimpleSubtitleDecoder.java:26)
        at com.google.android.exoplayer2.decoder.SimpleDecoder.decode(SimpleDecoder.java:224)
        at com.google.android.exoplayer2.decoder.SimpleDecoder.run(SimpleDecoder.java:189)
        at com.google.android.exoplayer2.decoder.SimpleDecoder.access$000(SimpleDecoder.java:25)
        at com.google.android.exoplayer2.decoder.SimpleDecoder$1.run(SimpleDecoder.java:67)
     Caused by: com.google.android.exoplayer2.ParserException: Expected WEBVTT. Got   <!DOCTYPE html>
        at com.google.android.exoplayer2.text.webvtt.WebvttParserUtil.validateWebvttHeaderLine(WebvttParserUtil.java:44)
        at com.google.android.exoplayer2.text.webvtt.WebvttDecoder.decode(WebvttDecoder.java:67)
        at com.google.android.exoplayer2.text.webvtt.WebvttDecoder.decode(WebvttDecoder.java:31) 
        at com.google.android.exoplayer2.text.SimpleSubtitleDecoder.decode(SimpleSubtitleDecoder.java:78) 
        at com.google.android.exoplayer2.text.SimpleSubtitleDecoder.decode(SimpleSubtitleDecoder.java:26) 
        at com.google.android.exoplayer2.decoder.SimpleDecoder.decode(SimpleDecoder.java:224) 
        at com.google.android.exoplayer2.decoder.SimpleDecoder.run(SimpleDecoder.java:189) 
        at com.google.android.exoplayer2.decoder.SimpleDecoder.access$000(SimpleDecoder.java:25) 
        at com.google.android.exoplayer2.decoder.SimpleDecoder$1.run(SimpleDecoder.java:67) 
@marcbaechinger
Copy link
Contributor

Expected WEBVTT. Got

I think if you enable a text track and the subtitle file is invalid as the one you tried you can not get around this exception.

The DOCTYPE line at the start may indicate that the server did not find the subtitle file at all and sent an error page instead which is html. Does the server deliver that response with a HTTP 200?

Also, is it possible to set subtitles on the fly without restarting the player?

No. That's not possible currently. You can sideload text tracks but you need to prepare the player for this.

@ojw28
Copy link
Contributor

ojw28 commented Jan 17, 2020

We have been making our subtitle and metadata decoders more "robust" over time (i.e., by logging an error and continuing rather than throwing). I'm not sure if this makes sense for this case.

The request to add subtitle files on the fly is tracked by #1649.

@ojw28 ojw28 assigned icbaker and unassigned marcbaechinger Jan 17, 2020
@casolorz
Copy link
Author

You are correct on the DOCTYPE reason. My app lets the users bring their own subtitles from many places and they often fail to load. With other devices where I do this, it just fails to load the subtitle gracefully but with ExoPlayer it is preventing the video from playing.

My guess is that the best solution for me in this case is to first attempt to load the VTT file using the Webvtt parser ExoPlayer uses to make sure it will work prior to setting it on the player?

@icbaker
Copy link
Collaborator

icbaker commented Jan 20, 2020

Related because it's also due to corrupt subtitles, although the failures look to be in a slightly different bits of the code: #6640

ojw28 pushed a commit that referenced this issue Feb 25, 2020
issue:#6885
PiperOrigin-RevId: 295931197
@ojw28
Copy link
Contributor

ojw28 commented Mar 13, 2020

@icbaker - Can we update and close this?

@icbaker
Copy link
Collaborator

icbaker commented Mar 13, 2020

Yep, good point. The commit above means these sorts of exceptions are now just logged and playback continues without the subtitles.

@icbaker icbaker closed this as completed Mar 13, 2020
ojw28 pushed a commit that referenced this issue Mar 30, 2020
issue:#6885
PiperOrigin-RevId: 295931197
@google google locked and limited conversation to collaborators May 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants