diff --git a/packages/video_player/CHANGELOG.md b/packages/video_player/CHANGELOG.md index abf41afcfbb0..4b1ce43d1465 100644 --- a/packages/video_player/CHANGELOG.md +++ b/packages/video_player/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.10.2+1 + +* Use DefaultHttpDataSourceFactory only when network schemas and use +DefaultHttpDataSourceFactory by default. + ## 0.10.2 * **Android Only** Adds optional VideoFormat used to signal what format the plugin should try. diff --git a/packages/video_player/android/src/main/java/io/flutter/plugins/videoplayer/VideoPlayerPlugin.java b/packages/video_player/android/src/main/java/io/flutter/plugins/videoplayer/VideoPlayerPlugin.java index 50c26d460fb3..5b1f55fe14d6 100644 --- a/packages/video_player/android/src/main/java/io/flutter/plugins/videoplayer/VideoPlayerPlugin.java +++ b/packages/video_player/android/src/main/java/io/flutter/plugins/videoplayer/VideoPlayerPlugin.java @@ -86,9 +86,7 @@ private static class VideoPlayer { Uri uri = Uri.parse(dataSource); DataSource.Factory dataSourceFactory; - if (isFileOrAsset(uri)) { - dataSourceFactory = new DefaultDataSourceFactory(context, "ExoPlayer"); - } else { + if (isHTTP(uri)) { dataSourceFactory = new DefaultHttpDataSourceFactory( "ExoPlayer", @@ -96,6 +94,8 @@ private static class VideoPlayer { DefaultHttpDataSource.DEFAULT_CONNECT_TIMEOUT_MILLIS, DefaultHttpDataSource.DEFAULT_READ_TIMEOUT_MILLIS, true); + } else { + dataSourceFactory = new DefaultDataSourceFactory(context, "ExoPlayer"); } MediaSource mediaSource = buildMediaSource(uri, dataSourceFactory, formatHint, context); @@ -104,12 +104,12 @@ private static class VideoPlayer { setupVideoPlayer(eventChannel, textureEntry, result); } - private static boolean isFileOrAsset(Uri uri) { + private static boolean isHTTP(Uri uri) { if (uri == null || uri.getScheme() == null) { return false; } String scheme = uri.getScheme(); - return scheme.equals("file") || scheme.equals("asset"); + return scheme.equals("http") || scheme.equals("https"); } private MediaSource buildMediaSource(