getListQuality method
Implementation
Future<List<QualityModel>> getListQuality() async {
final List<QualityModel> listQuality = [];
final result =
await PlayerAsmsUtils.getDataFromUrl(playerResource.videoUrl, null);
if (result != null) {
final PlayerKidDataHolder _response =
await PlayerAsmsUtils.parse(result, playerResource.videoUrl);
_response.tracks?.forEach((element) {
listQuality.add(QualityModel(
width: element.width ?? 0,
height: element.height ?? 0,
bitrate: element.bitrate ?? 0,
urlQuality: element.urlQuality ?? playerResource.videoUrl,
urlMovie: playerResource.videoUrl,
titleMovie: "No title",
trackIndex: element.id != "" ? int.parse(element.id!) : 0,
isSelected: false));
});
}
if (listQuality.isEmpty) {
listQuality.add(QualityModel(
width: 0,
height: 0,
bitrate: 0,
urlQuality: playerResource.videoUrl,
urlMovie: playerResource.videoUrl,
titleMovie: "No title",
trackIndex: 0,
isSelected: true));
}
this.listQuality = listQuality;
return listQuality;
}