Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 2 commits
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
4 changes: 4 additions & 0 deletions packages/video_player/video_player/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.11.1+3

* Android: Upgrade ExoPlayer to 2.12.1.

## 0.11.1+2

* Update android compileSdkVersion to 29.
Expand Down
15 changes: 5 additions & 10 deletions packages/video_player/video_player/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
group 'io.flutter.plugins.videoplayer'
version '1.0-SNAPSHOT'
def args = ["-Xlint:deprecation","-Xlint:unchecked","-Werror"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why remove this?

Copy link
Member Author

@hamdikahloun hamdikahloun Oct 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Embarrassed several developers and I have seen several issues for -werror. I want to keep it but I don't want to block developers.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably split this into separate patches to avoid a revert catching both when it only intends to get one. Otherwise LGTM


buildscript {
repositories {
Expand All @@ -9,7 +8,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
classpath 'com.android.tools.build:gradle:3.5.0'
}
}

Expand All @@ -20,10 +19,6 @@ rootProject.allprojects {
}
}

project.getTasks().withType(JavaCompile){
options.compilerArgs.addAll(args)
}

apply plugin: 'com.android.library'

android {
Expand All @@ -44,9 +39,9 @@ android {
}

dependencies {
implementation 'com.google.android.exoplayer:exoplayer-core:2.9.6'
implementation 'com.google.android.exoplayer:exoplayer-hls:2.9.6'
implementation 'com.google.android.exoplayer:exoplayer-dash:2.9.6'
implementation 'com.google.android.exoplayer:exoplayer-smoothstreaming:2.9.6'
implementation 'com.google.android.exoplayer:exoplayer-core:2.12.1'
implementation 'com.google.android.exoplayer:exoplayer-hls:2.12.1'
implementation 'com.google.android.exoplayer:exoplayer-dash:2.12.1'
implementation 'com.google.android.exoplayer:exoplayer-smoothstreaming:2.12.1'
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,20 @@
import android.view.Surface;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.ExoPlayerFactory;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.PlaybackParameters;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.Player.EventListener;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.audio.AudioAttributes;
import com.google.android.exoplayer2.extractor.DefaultExtractorsFactory;
import com.google.android.exoplayer2.source.ExtractorMediaSource;
import com.google.android.exoplayer2.source.MediaSource;
import com.google.android.exoplayer2.source.ProgressiveMediaSource;
import com.google.android.exoplayer2.source.dash.DashMediaSource;
import com.google.android.exoplayer2.source.dash.DefaultDashChunkSource;
import com.google.android.exoplayer2.source.hls.HlsMediaSource;
import com.google.android.exoplayer2.source.smoothstreaming.DefaultSsChunkSource;
import com.google.android.exoplayer2.source.smoothstreaming.SsMediaSource;
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector;
import com.google.android.exoplayer2.trackselection.TrackSelector;
import com.google.android.exoplayer2.upstream.DataSource;
import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory;
import com.google.android.exoplayer2.upstream.DefaultHttpDataSource;
Expand Down Expand Up @@ -70,8 +67,7 @@ final class VideoPlayer {
this.textureEntry = textureEntry;
this.options = options;

TrackSelector trackSelector = new DefaultTrackSelector();
exoPlayer = ExoPlayerFactory.newSimpleInstance(context, trackSelector);
exoPlayer = new SimpleExoPlayer.Builder(context).build();

Uri uri = Uri.parse(dataSource);

Expand All @@ -89,7 +85,8 @@ final class VideoPlayer {
}

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

setupVideoPlayer(eventChannel, textureEntry);
}
Expand Down Expand Up @@ -131,18 +128,18 @@ private MediaSource buildMediaSource(
return new SsMediaSource.Factory(
new DefaultSsChunkSource.Factory(mediaDataSourceFactory),
new DefaultDataSourceFactory(context, null, mediaDataSourceFactory))
.createMediaSource(uri);
.createMediaSource(MediaItem.fromUri(uri));
case C.TYPE_DASH:
return new DashMediaSource.Factory(
new DefaultDashChunkSource.Factory(mediaDataSourceFactory),
new DefaultDataSourceFactory(context, null, mediaDataSourceFactory))
.createMediaSource(uri);
.createMediaSource(MediaItem.fromUri(uri));
case C.TYPE_HLS:
return new HlsMediaSource.Factory(mediaDataSourceFactory).createMediaSource(uri);
return new HlsMediaSource.Factory(mediaDataSourceFactory)
.createMediaSource(MediaItem.fromUri(uri));
case C.TYPE_OTHER:
return new ExtractorMediaSource.Factory(mediaDataSourceFactory)
.setExtractorsFactory(new DefaultExtractorsFactory())
.createMediaSource(uri);
return new ProgressiveMediaSource.Factory(mediaDataSourceFactory)
.createMediaSource(MediaItem.fromUri(uri));
default:
{
throw new IllegalStateException("Unsupported type: " + type);
Expand Down Expand Up @@ -174,7 +171,7 @@ public void onCancel(Object o) {
new EventListener() {

@Override
public void onPlayerStateChanged(final boolean playWhenReady, final int playbackState) {
public void onPlaybackStateChanged(final int playbackState) {
if (playbackState == Player.STATE_BUFFERING) {
sendBufferingUpdate();
} else if (playbackState == Player.STATE_READY) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ public TextureMessage create(CreateMessage arg) {
"asset:///" + assetLookupKey,
null,
options);
videoPlayers.put(handle.id(), player);
} else {
player =
new VideoPlayer(
Expand All @@ -148,8 +147,8 @@ public TextureMessage create(CreateMessage arg) {
arg.getUri(),
arg.getFormatHint(),
options);
videoPlayers.put(handle.id(), player);
}
videoPlayers.put(handle.id(), player);

TextureMessage result = new TextureMessage();
result.setTextureId(handle.id());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ android {
defaultConfig {
applicationId "io.flutter.plugins.videoplayerexample"
minSdkVersion 16
targetSdkVersion 28
targetSdkVersion 29
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
classpath 'com.android.tools.build:gradle:3.5.0'
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
2 changes: 1 addition & 1 deletion packages/video_player/video_player/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: Flutter plugin for displaying inline video with other Flutter
# 0.10.y+z is compatible with 1.0.0, if you land a breaking change bump
# the version to 2.0.0.
# See more details: https://github.com/flutter/flutter/wiki/Package-migration-to-1.0.0
version: 0.11.1+2
version: 0.11.1+3
homepage: https://github.com/flutter/plugins/tree/master/packages/video_player/video_player

flutter:
Expand Down