Videos.multiVideoWithSingleType constructor

Videos.multiVideoWithSingleType({
  1. required List<String> videos,
  2. required VideoType type,
})

Videos.multiVideoWithSingleType Only for Videos with same type

Videos.multiVideoWithSingleType(videos : ["path 1","path 2"], type : type) // default type is network

videoPath List<String> type VideoType

Implementation

Videos.multiVideoWithSingleType({
  required List<String> videos,
  required VideoType type,
}) {
  List<Media> result = [];
  // Future<List<Media>> addVideos(final List<Uint8List> data) async {
  //   final List<Media> videos = [];
  //   for (final video in data) {
  //     videos.add(await Media.memory(video));
  //   }
  //   return videos;
  // }

  switch (type) {
    case VideoType.file:
      if (kIsWeb) throw 'VideoType.file can\'t be used in web platform';
      for (final video in videos) {
        result.add(Media('file:///$video'));
      }
      this.videos = result;
      break;
    case VideoType.assets:
      for (final video in videos) {
        result.add(Media('asset:///$video'));
      }
      this.videos = result;
    // case VideoType.memory:
    //   addVideos(videos as List<Uint8List>).then(
    //     (value) => this.videos.value = value,
    //   );
    //   break;
    default:
      this.videos.addAll(
            List.generate(
              videos.length,
              (index) => Media(videos[index]),
            ),
          );
  }
}