From 3c289b5ceefead765bad6d779d4d13346ecdcaf2 Mon Sep 17 00:00:00 2001 From: Brad Chien Date: Tue, 9 May 2023 16:33:00 +0800 Subject: [PATCH 1/9] fix time tag parse issue & add merge method --- example/merge_example.dart | 131 +++++++++++++++++++++++++ lib/src/core/models.dart | 15 +++ lib/src/utils/regexes.dart | 33 ++++++- lib/src/utils/subtitle_controller.dart | 61 +++++++++++- lib/src/utils/subtitle_parser.dart | 73 ++++++-------- lib/src/utils/subtitle_provider.dart | 17 ++++ lib/src/utils/types.dart | 8 +- pubspec.yaml | 6 +- 8 files changed, 289 insertions(+), 55 deletions(-) create mode 100644 example/merge_example.dart diff --git a/example/merge_example.dart b/example/merge_example.dart new file mode 100644 index 0000000..d56218d --- /dev/null +++ b/example/merge_example.dart @@ -0,0 +1,131 @@ +import 'package:subtitle/subtitle.dart'; + +const vttData = '''WEBVTT FILE + +5 +00:00:19.000 --> 00:00:24.000 +Which is why we are bringing TV, internet and phone together in one super package + +3 +00:00:11.000 --> 00:00:14.000 A:end +Phone conversations where people truly connect + +1 +00:00:03.500 --> 00:00:05.000 D:vertical A:start +Everyone wants the most from life + +2 +00:00:06.000 --> 00:00:09.000 A:start +Like internet experiences that are rich and entertaining + + +4 +00:00:14.500 --> 00:00:18.000 +Your favourite TV programmes ready to watch at the touch of a button + +6 +00:00:24.500 --> 00:00:26.000 +One simple way to get everything + +7 +00:00:26.500 --> 00:00:27.500 L:12% +UPC + +8 +00:00:28.000 --> 00:00:30.000 L:75% +Simply for everyone'''; + +const ttmlText = ''' + + + + + Timed Text TTML Example + The Authors (c) 2006 + + + +