fromNetworkVideoSources static method

Map<String, VideoSource> fromNetworkVideoSources(
  1. Map<String, String> sources, {
  2. String initialSubtitle = "",
  3. Map<String, VideoViewerSubtitle>? subtitle,
  4. List<VideoViewerAd>? ads,
  5. Tween<Duration>? range,
})

It's a function that returns a map from VideoPlayerController.network, the input data must be of type URL.

If subtitle is no-null, set for all URLs the same subtitles.

INPUT:

VideoSource.fromNetworkVideoSources({
   "720p": "https://github.com/intel-iot-devkit/sample-videos/blob/master/classroom.mp4",
   "1080p": "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerBlazes.mp4",
})

OUTPUT:

{
   "720p": VideoSource(
      video: VideoPlayerController.network("https://github.com/intel-iot-devkit/sample-videos/blob/master/classroom.mp4"),
      intialSubtitle: initialSubtitle
      subtitle: subtitle,
   ),
   "1080p": VideoSource(
      video: VideoPlayerController.network("http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerBlazes.mp4"),
      intialSubtitle: initialSubtitle
      subtitle: subtitle,
   ),
}

Implementation

static Map<String, VideoSource> fromNetworkVideoSources(
  Map<String, String> sources, {
  String initialSubtitle = "",
  Map<String, VideoViewerSubtitle>? subtitle,
  List<VideoViewerAd>? ads,
  Tween<Duration>? range,
}) {
  Map<String, VideoSource> videoSource = {};
  for (String key in sources.keys)
    videoSource[key] = VideoSource(
      video: VideoPlayerController.network(sources[key]!),
      intialSubtitle: initialSubtitle,
      subtitle: subtitle,
      range: range,
      ads: ads,
    );
  return videoSource;
}