parse static method

Future<PipFlutterPlayerAsmsDataHolder> parse(
  1. String data,
  2. String masterPlaylistUrl
)

Implementation

static Future<PipFlutterPlayerAsmsDataHolder> parse(
    String data, String masterPlaylistUrl) async {
  List<PipFlutterPlayerAsmsTrack> tracks = [];
  List<PipFlutterPlayerAsmsSubtitle> subtitles = [];
  List<PipFlutterPlayerAsmsAudioTrack> audios = [];
  try {
    final List<List<dynamic>> list = await Future.wait([
      parseTracks(data, masterPlaylistUrl),
      parseSubtitles(data, masterPlaylistUrl),
      parseLanguages(data, masterPlaylistUrl)
    ]);
    tracks = list[0] as List<PipFlutterPlayerAsmsTrack>;
    subtitles = list[1] as List<PipFlutterPlayerAsmsSubtitle>;
    audios = list[2] as List<PipFlutterPlayerAsmsAudioTrack>;
  } catch (exception) {
    PipFlutterPlayerUtils.log("Exception on hls parse: $exception");
  }
  return PipFlutterPlayerAsmsDataHolder(
      tracks: tracks, audios: audios, subtitles: subtitles);
}