onTargetQualityChange method

  1. @override
void onTargetQualityChange(
  1. int videoTrackUid,
  2. List<int?> qualitiesUid,
  3. int? qualityUid
)
override

Implementation

@override
void onTargetQualityChange(int videoTrackUid, List<int?> qualitiesUid, int? qualityUid) {
  VideoTrackImpl? videoTrack = _videoTracks.firstWhereOrNull((item) => item.uid == videoTrackUid) as VideoTrackImpl?;
  if (videoTrack == null) {
    return;
  }

  VideoQualitiesImpl targetQualities = VideoQualitiesImpl();
  targetQualities.addAll(
      videoTrack.qualities.where((element) => qualitiesUid.contains(element.uid))
  );
  VideoQuality? targetQuality = videoTrack.qualities.firstWhereOrNull((element) => element.uid == qualityUid);

  videoTrack.targetQualities = targetQualities;
  videoTrack.targetQuality = targetQuality;
  videoTrack.dispatchEvent(VideoTargetQualityChangedEvent(qualities: targetQualities, quality: targetQuality));
}