parseLanguages static method
Implementation
static Future<List<PipFlutterPlayerAsmsAudioTrack>> parseLanguages(
String data, String masterPlaylistUrl) async {
final List<PipFlutterPlayerAsmsAudioTrack> audios = [];
final parsedPlaylist = await HlsPlaylistParser.create()
.parseString(Uri.parse(masterPlaylistUrl), data);
if (parsedPlaylist is HlsMasterPlaylist) {
for (int index = 0; index < parsedPlaylist.audios.length; index++) {
final Rendition audio = parsedPlaylist.audios[index];
audios.add(PipFlutterPlayerAsmsAudioTrack(
id: index,
label: audio.name,
language: audio.format.language,
url: audio.url.toString(),
));
}
}
return audios;
}