Skip to content

Commit

Permalink
Remove use of deprecated SimpleExoPlayer class
Browse files Browse the repository at this point in the history
Recommendation is just to use ExoPlayer now.
Updating the ReadMe too.
  • Loading branch information
Ben Staveley-Taylor committed Apr 6, 2023
1 parent d2bb0c8 commit ee3352d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ This library depends ExoPlayer core 2.18.0
## Sample Usage

### STEP 1
Create [SimpleExoPlayer](https://google.github.io/ExoPlayer/guide.html#creating-the-player) instance.
Create [ExoPlayer](https://exoplayer.dev/hello-world.html#creating-the-player) instance.
In this case, play MP4 file. <br>
Read [this](https://google.github.io/ExoPlayer/guide.html#add-exoplayer-as-a-dependency) if you want to play other video formats. <br>
Read [this](https://exoplayer.dev/hello-world.html#adding-exoplayer-as-a-dependency) if you want to play other video formats. <br>
```JAVA
// Produces DataSource instances through which media data is loaded.
DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(this, Util.getUserAgent(this, "yourApplicationName"));

// SimpleExoPlayer
player = new SimpleExoPlayer.Builder(this)
player = new ExoPlayer.Builder(this)
.setMediaSourceFactory(new ProgressiveMediaSource.Factory(dataSourceFactory))
.build();
player.addMediaItem(MediaItem.fromUri(Constant.STREAM_URL_MP4_VOD_SHORT));
Expand Down
6 changes: 3 additions & 3 deletions epf/src/main/java/com/daasuu/epf/EPlayerRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import com.daasuu.epf.filter.GlFilter;
import com.daasuu.epf.filter.GlLookUpTableFilter;
import com.daasuu.epf.filter.GlPreviewFilter;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.ExoPlayer;

import javax.microedition.khronos.egl.EGLConfig;

Expand Down Expand Up @@ -51,7 +51,7 @@ class EPlayerRenderer extends EFrameBufferObjectRenderer implements SurfaceTextu

private float aspectRatio = 1f;

private SimpleExoPlayer simpleExoPlayer;
private ExoPlayer simpleExoPlayer;

EPlayerRenderer(EPlayerView glPreview) {
super();
Expand Down Expand Up @@ -181,7 +181,7 @@ public synchronized void onFrameAvailable(final SurfaceTexture previewTexture) {
glPreview.requestRender();
}

void setSimpleExoPlayer(SimpleExoPlayer simpleExoPlayer) {
void setSimpleExoPlayer(ExoPlayer simpleExoPlayer) {
this.simpleExoPlayer = simpleExoPlayer;
}

Expand Down
6 changes: 3 additions & 3 deletions epf/src/main/java/com/daasuu/epf/EPlayerView.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import com.daasuu.epf.chooser.EConfigChooser;
import com.daasuu.epf.contextfactory.EContextFactory;
import com.daasuu.epf.filter.GlFilter;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.video.VideoSize;

/**
Expand All @@ -19,7 +19,7 @@ public class EPlayerView extends GLSurfaceView implements Player.Listener {
private final static String TAG = EPlayerView.class.getSimpleName();

private final EPlayerRenderer renderer;
private SimpleExoPlayer player;
private ExoPlayer player;

private float videoAspect = 1f;
private PlayerScaleType playerScaleType = PlayerScaleType.RESIZE_FIT_WIDTH;
Expand All @@ -39,7 +39,7 @@ public EPlayerView(Context context, AttributeSet attrs) {

}

public EPlayerView setSimpleExoPlayer(SimpleExoPlayer player) {
public EPlayerView setSimpleExoPlayer(ExoPlayer player) {
if (this.player != null) {
this.player.release();
this.player = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
import androidx.appcompat.app.AppCompatActivity;

import com.daasuu.epf.EPlayerView;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.source.ProgressiveMediaSource;
import com.google.android.exoplayer2.upstream.DataSource;
import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory;
Expand All @@ -25,7 +25,7 @@
public class MainActivity extends AppCompatActivity {

private EPlayerView ePlayerView;
private SimpleExoPlayer player;
private ExoPlayer player;
private Button button;
private SeekBar seekBar;
private PlayerTimer playerTimer;
Expand Down Expand Up @@ -122,7 +122,7 @@ private void setUpSimpleExoPlayer() {
DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(this, Util.getUserAgent(this, "yourApplicationName"));

// SimpleExoPlayer
player = new SimpleExoPlayer.Builder(this)
player = new ExoPlayer.Builder(this)
.setMediaSourceFactory(new ProgressiveMediaSource.Factory(dataSourceFactory))
.build();
player.addMediaItem(MediaItem.fromUri(Constant.STREAM_URL_MP4_VOD_SHORT));
Expand Down

0 comments on commit ee3352d

Please sign in to comment.