google / ExoPlayer

This project is deprecated and stale. The latest ExoPlayer code is available in https://github.com/androidx/media
https://developer.android.com/media/media3/exoplayer
Apache License 2.0
21.74k stars 6.03k forks source link

First Line subtitle was lost . #1136

Closed vipjml closed 8 years ago

vipjml commented 8 years ago

http://subscene.com/subtitle/download?mac=9vdN541sK3CJzJXlawzukVbLF_YeiqKwsB62_ws6DQGT981Az0vVhZao5RCKs2bY0

The first line subtitle was lost. This subtitle is utf-8 with bom, So the first line is "\uFEFF1",so the parseInt of the first line is failed. I think the follow code should add a special handle for utf-8 bom file.

SubripParser:74

 // Parse the index line as a sanity check.
 try {
Integer.parseInt(currentLine);
 } catch (NumberFormatException e) {
 Log.w(TAG, "Skipping invalid index: " + currentLine);
continue;
 }
ojw28 commented 8 years ago

Thanks for reporting this. Parsing of this file actually fails even more badly on the dev branch due to a separate issue. We'll fix that, and then fix the specific issue that you mention. We'll put the fix in a place where it will apply more generally, rather than only for Subrip.

ojw28 commented 8 years ago

Fixed on the dev branch.