@@ -222,6 +222,21 @@ class VideoPlayerController extends ValueNotifier<VideoPlayerValue> {
222222 httpHeaders = const {},
223223 super (VideoPlayerValue (duration: Duration .zero));
224224
225+ /// Constructs a [VideoPlayerController] playing a video from a contentUri.
226+ ///
227+ /// This will load the video from the input content-URI.
228+ /// This is supported on Android only.
229+ VideoPlayerController .contentUri (Uri contentUri,
230+ {this .closedCaptionFile, this .videoPlayerOptions})
231+ : assert (defaultTargetPlatform == TargetPlatform .android,
232+ 'VideoPlayerController.contentUri is only supported on Android.' ),
233+ dataSource = contentUri.toString (),
234+ dataSourceType = DataSourceType .contentUri,
235+ package = null ,
236+ formatHint = null ,
237+ httpHeaders = const {},
238+ super (VideoPlayerValue (duration: Duration .zero));
239+
225240 /// The URI to the video file. This will be in different formats depending on
226241 /// the [DataSourceType] of the original video.
227242 final String dataSource;
@@ -298,6 +313,12 @@ class VideoPlayerController extends ValueNotifier<VideoPlayerValue> {
298313 uri: dataSource,
299314 );
300315 break ;
316+ case DataSourceType .contentUri:
317+ dataSourceDescription = DataSource (
318+ sourceType: DataSourceType .contentUri,
319+ uri: dataSource,
320+ );
321+ break ;
301322 }
302323
303324 if (videoPlayerOptions? .mixWithOthers != null ) {
0 commit comments