@@ -222,6 +222,21 @@ class VideoPlayerController extends ValueNotifier<VideoPlayerValue> {
222
222
httpHeaders = const {},
223
223
super (VideoPlayerValue (duration: Duration .zero));
224
224
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
+
225
240
/// The URI to the video file. This will be in different formats depending on
226
241
/// the [DataSourceType] of the original video.
227
242
final String dataSource;
@@ -298,6 +313,12 @@ class VideoPlayerController extends ValueNotifier<VideoPlayerValue> {
298
313
uri: dataSource,
299
314
);
300
315
break ;
316
+ case DataSourceType .contentUri:
317
+ dataSourceDescription = DataSource (
318
+ sourceType: DataSourceType .contentUri,
319
+ uri: dataSource,
320
+ );
321
+ break ;
301
322
}
302
323
303
324
if (videoPlayerOptions? .mixWithOthers != null ) {
0 commit comments