Skip to content

Commit

Permalink
exoplayer 2.7.3
Browse files Browse the repository at this point in the history
  • Loading branch information
najeira committed May 22, 2018
1 parent a662666 commit e243e21
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
4 changes: 2 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ android {
}

dependencies {
implementation 'com.google.android.exoplayer:exoplayer-core:2.6.0'
implementation 'com.google.android.exoplayer:exoplayer-hls:2.6.0'
implementation 'com.google.android.exoplayer:exoplayer-core:2.7.3'
implementation 'com.google.android.exoplayer:exoplayer-hls:2.7.3'
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

import android.app.Activity;
import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
import android.util.LongSparseArray;
import android.view.Surface;

Expand All @@ -18,7 +16,6 @@
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.extractor.DefaultExtractorsFactory;
import com.google.android.exoplayer2.mediacodec.MediaCodecRenderer;
import com.google.android.exoplayer2.mediacodec.MediaCodecUtil;
import com.google.android.exoplayer2.source.BehindLiveWindowException;
Expand All @@ -36,6 +33,7 @@
import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory;
import com.google.android.exoplayer2.upstream.DefaultHttpDataSourceFactory;
import com.google.android.exoplayer2.util.Util;
import com.google.android.exoplayer2.video.VideoListener;

import io.flutter.plugin.common.EventChannel;
import io.flutter.plugin.common.MethodCall;
Expand All @@ -54,7 +52,7 @@
import java.util.Map;

public class VideoPlayerPlugin implements MethodCallHandler {
private static class VideoPlayer implements Player.EventListener, SimpleExoPlayer.VideoListener {
private static class VideoPlayer implements Player.EventListener, VideoListener {
private static final DefaultBandwidthMeter BANDWIDTH_METER = new DefaultBandwidthMeter();
private static final CookieManager DEFAULT_COOKIE_MANAGER;

Expand All @@ -63,7 +61,6 @@ private static class VideoPlayer implements Player.EventListener, SimpleExoPlaye
DEFAULT_COOKIE_MANAGER.setCookiePolicy(CookiePolicy.ACCEPT_ORIGINAL_SERVER);
}

private Handler mainHandler;
private final TextureRegistry.SurfaceTextureEntry textureEntry;
private EventChannel.EventSink eventSink;
private final EventChannel eventChannel;
Expand Down Expand Up @@ -100,15 +97,12 @@ private static class VideoPlayer implements Player.EventListener, SimpleExoPlaye
Result result) {
this.activity = activity;
this.eventChannel = eventChannel;
//this.mediaPlayer = new MediaPlayer();
this.textureEntry = textureEntry;
this.dataSource = Uri.parse(dataSource);
setupVideoPlayer(textureEntry, result);
}

private void setupVideoPlayer(TextureRegistry.SurfaceTextureEntry textureEntry, Result result) {
mainHandler = new Handler(Looper.getMainLooper());

eventChannel.setStreamHandler(
new EventChannel.StreamHandler() {
@Override
Expand Down Expand Up @@ -146,7 +140,7 @@ private void initializePlayer() {

player = ExoPlayerFactory.newSimpleInstance(this.activity, trackSelector);
player.addListener(this);
player.setVideoListener(this);
player.addVideoListener(this);
player.setPlayWhenReady(true);
player.setRepeatMode(Player.REPEAT_MODE_ALL);
}
Expand All @@ -160,9 +154,9 @@ private void initializePlayer() {
private MediaSource buildMediaSource(Uri uri) {
int type = Util.inferContentType(uri);
if (type == C.TYPE_HLS) {
return new HlsMediaSource(uri, mediaDataSourceFactory, mainHandler, null);
return new HlsMediaSource.Factory(mediaDataSourceFactory).createMediaSource(uri);
}
return new ExtractorMediaSource(uri, mediaDataSourceFactory, new DefaultExtractorsFactory(), mainHandler, null);
return new ExtractorMediaSource.Factory(mediaDataSourceFactory).createMediaSource(uri);
}

void play() {
Expand Down Expand Up @@ -233,7 +227,7 @@ private void bufferingUpdate() {
}

@Override
public void onTimelineChanged(Timeline timeline, Object manifest) {
public void onTimelineChanged(Timeline timeline, Object manifest, int reason) {

}

Expand Down

0 comments on commit e243e21

Please sign in to comment.