dsc-uob / subtitle

Subtitle decoder package, enables you to handle translation data smoothly.
https://dsc-uob.github.io/subtitle/
MIT License
10 stars 18 forks source link

RangeError: Value not in range: 11? #9

Closed fadone closed 1 month ago

fadone commented 1 year ago

I am getting this error when using asset subtitle, Unhandled Exception: RangeError: Value not in range: 11 E/flutter (31902): #0 _RegExpMatch.group (dart:core-patch/regexp_patch.dart:95:7) E/flutter (31902): #1 SubtitleParser._decodeSubtitleFormat subtitle_parser.dart:87 E/flutter (31902): #2 SubtitleParser.parsing subtitle_parser.dart:61 E/flutter (31902): #3 ISubtitleController.initial subtitle_controller.dart:5

Here is my code, SubtitleController? _subtitleController; _subtitleController = SubtitleController( provider: const AssetSubtitle('assets/videos/video.srt'), ); await _subtitleController!.initial();

And here is the subtitle line where the error is occuring, 1 00:00:00,009 --> 00:00:03,258 Let me give you the best analogy you've ever heard about the human body.

thinhnd-nal commented 1 year ago

I was forced back to beta.3 using subtitle: 0.1.0-beta.3 (without the ^). Or you can also use this lib instead https://pub.dev/packages/subtitle_wrapper_package

boqxfjge commented 1 year ago

Same error! I tried subtitle: 0.1.0-beta.3,but the result of print(controller.subtitles) became empty list: [] Here is my srt subtitle (it has double text lines):

14
00:00:45,520 --> 00:00:46,520
A:いいですか?
A:这样可以吗?

15
00:00:47,600 --> 00:00:49,160
B:はい、いいです。
B:嗯,可以的。
Yang321423 commented 5 months ago

This package seems to have a serious flaw. It only handles English subtitles. For non-English subtitles, controller.subtitles becomes an empty list ([ ]). I guess he made a mistake using RegExp.

MuhmdHsn313 commented 1 month ago

Solved with #12