parseTracks static method
Implementation
static Future<List<PlayerKidTrack>> parseTracks(
String data, String masterPlaylistUrl) async {
final List<PlayerKidTrack> tracks = [];
try {
final parsedPlaylist = await HlsPlaylistParser.create()
.parseString(Uri.parse(masterPlaylistUrl), data);
if (parsedPlaylist is HlsMasterPlaylist) {
parsedPlaylist.variants.forEach(
(variant) {
tracks.add(PlayerKidTrack(
variant.format.id,
variant.format.width,
variant.format.height,
variant.format.bitrate,
variant.url.toString(),
0,
'',
''));
},
);
}
//For auto quality
if (tracks.isNotEmpty) {
tracks.insert(
0, PlayerKidTrack("0", 0, 0, 0, parsedPlaylist.baseUri, 0, '', ''));
}
} catch (exception) {
print("Exception on parseSubtitles: $exception");
}
return tracks;
}