[video-player] add support for content uris as urls (#1813)
content:// uris will be routed from DefaultDataSourceFactory in Android
diff --git a/packages/video_player/CHANGELOG.md b/packages/video_player/CHANGELOG.md
index abf41af..4b1ce43 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 50c26d4..5b1f55f 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 @@
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 @@
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 @@
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(