Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[video-player] add support for content uris as urls (flutter#1813)
content:// uris will be routed from DefaultDataSourceFactory in Android
  • Loading branch information
udnisap authored and Chris Yang committed Sep 4, 2019
commit 163bbec94f2d0103e182c5256a444a8f5085dd51
5 changes: 5 additions & 0 deletions packages/video_player/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,16 @@ 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",
null,
DefaultHttpDataSource.DEFAULT_CONNECT_TIMEOUT_MILLIS,
DefaultHttpDataSource.DEFAULT_READ_TIMEOUT_MILLIS,
true);
} else {
dataSourceFactory = new DefaultDataSourceFactory(context, "ExoPlayer");
}

MediaSource mediaSource = buildMediaSource(uri, dataSourceFactory, formatHint, context);
Expand All @@ -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(
Expand Down