@@ -228,6 +228,21 @@ class VideoPlayerController extends ValueNotifier<VideoPlayerValue> {
228
228
httpHeaders = const {},
229
229
super (VideoPlayerValue (duration: Duration .zero));
230
230
231
+ /// Constructs a [VideoPlayerController] playing a video from a contentUri.
232
+ ///
233
+ /// This will load the video from the input content-URI.
234
+ /// This is supported on Android only.
235
+ VideoPlayerController .contentUri (Uri contentUri,
236
+ {this .closedCaptionFile, this .videoPlayerOptions})
237
+ : assert (defaultTargetPlatform == TargetPlatform .android,
238
+ 'VideoPlayerController.contentUri is only supported on Android.' ),
239
+ dataSource = contentUri.toString (),
240
+ dataSourceType = DataSourceType .contentUri,
241
+ package = null ,
242
+ formatHint = null ,
243
+ httpHeaders = const {},
244
+ super (VideoPlayerValue (duration: Duration .zero));
245
+
231
246
/// The URI to the video file. This will be in different formats depending on
232
247
/// the [DataSourceType] of the original video.
233
248
final String dataSource;
@@ -304,6 +319,12 @@ class VideoPlayerController extends ValueNotifier<VideoPlayerValue> {
304
319
uri: dataSource,
305
320
);
306
321
break ;
322
+ case DataSourceType .contentUri:
323
+ dataSourceDescription = DataSource (
324
+ sourceType: DataSourceType .contentUri,
325
+ uri: dataSource,
326
+ );
327
+ break ;
307
328
}
308
329
309
330
if (videoPlayerOptions? .mixWithOthers != null ) {
0 commit comments