PlayerKidSubtitle constructor

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

Implementation

factory PlayerKidSubtitle(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 PlayerKidSubtitle._();
  } catch (exception) {
    print("Failed to parse subtitle line: $value");
    return PlayerKidSubtitle._();
  }
}