How do i open srt file on flutter?
217
it wasn't the size after all I tested on some srt files that have a blank space for some duration and the flutter converter do a check on every element if the length is<3 it break on get out of the loop
Author by
motasem marqa
Updated on January 03, 2023Comments
-
motasem marqa over 1 year
I am trying to load subtitle to a video using the flutter video player package it works good for short files but it stopped as the file get bigger I trayed subtitle_wrapper package but it has many bugs
Future<ClosedCaptionFile> getSubtitle(String url) async { final data = NetworkAssetBundle(Uri(path: url)); final newdata = await data.load(url); String fileContents = getStringFromBytes(newdata); return captionFile = SubRipCaptionFile(fileContents); }
this is getStringFromBytes function
getStringFromBytes(ByteData data) { final buffer = data.buffer; var list = buffer.asUint8List(data.offsetInBytes, data.lengthInBytes); return utf8.decode(list); }
-
Majid about 2 yearsHow about this package pub.dev/packages/subtitle?
-
motasem marqa about 2 years@Majid i will try it now
-