Skip to content

Commit

Permalink
Revert "Use exoplayer's prefered API for MediaSources (flutter#857)"
Browse files Browse the repository at this point in the history
This reverts commit 8f5c26d.
  • Loading branch information
andreidiaconu committed Feb 17, 2019
1 parent 76eebdc commit 0b6441b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 22 deletions.
4 changes: 0 additions & 4 deletions packages/video_player/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
## 0.7.2

* Updated to use factories on exoplayer `MediaSource`s for Android instead of the now-deprecated constructors.

## 0.7.1

* Fixed null exception on Android when the video has a width or height of 0.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,33 +92,27 @@ private static class VideoPlayer {
true);
}

MediaSource mediaSource = buildMediaSource(uri, dataSourceFactory, context);
MediaSource mediaSource = buildMediaSource(uri, dataSourceFactory);
exoPlayer.prepare(mediaSource);

setupVideoPlayer(eventChannel, textureEntry, result);
}


private MediaSource buildMediaSource(Uri uri, DataSource.Factory mediaDataSourceFactory, Context context) {
private MediaSource buildMediaSource(Uri uri, DataSource.Factory mediaDataSourceFactory) {
int type = Util.inferContentType(uri.getLastPathSegment());
switch (type) {
case C.TYPE_SS:
return new SsMediaSource.Factory(
new DefaultSsChunkSource.Factory(mediaDataSourceFactory),
new DefaultDataSourceFactory(context, null, mediaDataSourceFactory))
.createMediaSource(uri);
return new SsMediaSource(
uri, null, new DefaultSsChunkSource.Factory(mediaDataSourceFactory), null, null);
case C.TYPE_DASH:
return new DashMediaSource.Factory(
new DefaultDashChunkSource.Factory(mediaDataSourceFactory),
new DefaultDataSourceFactory(context, null, mediaDataSourceFactory))
.createMediaSource(uri);
return new DashMediaSource(
uri, null, new DefaultDashChunkSource.Factory(mediaDataSourceFactory), null, null);
case C.TYPE_HLS:
return new HlsMediaSource.Factory(mediaDataSourceFactory).createMediaSource(uri);
return new HlsMediaSource(uri, mediaDataSourceFactory, null, null);
case C.TYPE_OTHER:
return new ExtractorMediaSource.Factory(mediaDataSourceFactory)
.setExtractorsFactory(new DefaultExtractorsFactory())
.createMediaSource(uri);
default:
return new ExtractorMediaSource(
uri, mediaDataSourceFactory, new DefaultExtractorsFactory(), null, null);
default:
{
throw new IllegalStateException("Unsupported type: " + type);
}
Expand Down Expand Up @@ -382,4 +376,4 @@ private void onMethodCall(MethodCall call, Result result, long textureId, VideoP
break;
}
}
}
}
2 changes: 1 addition & 1 deletion packages/video_player/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: video_player
description: Flutter plugin for displaying inline video with other Flutter
widgets on Android and iOS.
author: Flutter Team <flutter-dev@googlegroups.com>
version: 0.7.2
version: 0.7.1
homepage: https://github.com/flutter/plugins/tree/master/packages/video_player

flutter:
Expand Down

0 comments on commit 0b6441b

Please sign in to comment.