PipFlutterPlayerSubtitle constructor

PipFlutterPlayerSubtitle(
  1. String value,
  2. bool isWebVTT
)

Implementation

factory PipFlutterPlayerSubtitle(String value, bool isWebVTT) {
  try {
    final scanner = value.split('\n');
    if (scanner.length == 2) {
      return _handle2LinesSubtitles(scanner);
    }
    if (scanner.length > 2) {
      return _handle3LinesAndMoreSubtitles(scanner, isWebVTT);
    }
    return PipFlutterPlayerSubtitle._();
  } catch (exception) {
    PipFlutterPlayerUtils.log("Failed to parse subtitle line: $value");
    return PipFlutterPlayerSubtitle._();
  }
}