setQuality method

  1. @override
void setQuality(
  1. String quality
)
override

Implementation

@override
void setQuality(String quality) async {
  _videoPlayerController.dispose();
  if (source is YouTubeFlexPlayerSource) {
    final flexYoutubecontroller = FlexYoutubeController.instance;
    final video = flexYoutubecontroller.videosList.firstWhere(
      (element) => element.quality == quality,
    );
    final url = video.url.toString();
    _videoPlayerController = VideoPlayerController.networkUrl(
      Uri.parse(url),
    );
    reload();
  }
  if (source is NetworkFlexPlayerSource) {
    final video = videosList.firstWhere(
      (element) => element.quality == quality,
    );
    final url = video.url.toString();
    _videoPlayerController = VideoPlayerController.networkUrl(
      Uri.parse(url),
    );
    reload();
  }
}