getVideoQualities method

List<VideoQuality> getVideoQualities(
  1. StreamManifest manifest
)

Gets the video qualities available for a StreamManifest.

Implementation

List<VideoQuality> getVideoQualities(
  StreamManifest manifest,
) {
  List<VideoQuality> muxed = manifest.muxed
      .where((e) => e.videoCodec.contains('avc1'))
      .map((e) => e.videoQuality)
      .toList();
  List<VideoQuality> videoOnly = manifest.videoOnly
      .where((e) => e.videoCodec.contains('avc1'))
      .map((e) => e.videoQuality)
      .toList();

  List<VideoQuality> qualities = [
    ...muxed,
    ...videoOnly,
  ];

  qualities = qualities.toSet().toList();
  qualities.sort((a, b) => a.index.compareTo(b.index));
  return qualities;
}