parseSubtitles static method
Parse subtitles from provided m3u8 url
Implementation
static Future<List<PipFlutterPlayerAsmsSubtitle>> parseSubtitles(
String data, String masterPlaylistUrl) async {
final List<PipFlutterPlayerAsmsSubtitle> subtitles = [];
try {
final parsedPlaylist = await HlsPlaylistParser.create()
.parseString(Uri.parse(masterPlaylistUrl), data);
if (parsedPlaylist is HlsMasterPlaylist) {
for (final Rendition element in parsedPlaylist.subtitles) {
final hlsSubtitle = await _parseSubtitlesPlaylist(element);
if (hlsSubtitle != null) {
subtitles.add(hlsSubtitle);
}
}
}
} catch (exception) {
PipFlutterPlayerUtils.log("Exception on parseSubtitles: $exception");
}
return subtitles;
}