I'm currently working with the latest ExoPlayer
update and I'm getting calls that it is deprecated, could someone help me?
private fun initializePlayer () {
if (simpleExoPlayer == null) {
val trackSelector = DefaultTrackSelector(this)
val loadControl = DefaultLoadControl()
simpleExoPlayer = E̶x̶o̶P̶l̶a̶y̶e̶r̶F̶a̶c̶t̶o̶r̶y̶.̶n̶e̶w̶S̶i̶m̶p̶l̶e̶I̶n̶s̶t̶a̶n̶c̶e̶(this, trackSelector, loadControl)
}
}
Setting Up Exoplayer version(2.11.8) :
Sep 2020 Update:
//Setting Up Exoplayer
private void SetupPlayer(){
SimpleExoPlayer simpleExoPlayer;
// Create a data source factory.
dataSourceFactory =
new DefaultHttpDataSourceFactory(Util.getUserAgent(this
, getApplicationInfo().loadLabel(getPackageManager()).toString()));
// Passing Load Control
loadControl = new DefaultLoadControl.Builder()
.setBufferDurationsMs(25000, 50000, 1500, 2000).createDefaultLoadControl();
@DefaultRenderersFactory.ExtensionRendererMode int extensionRendererMode = DefaultRenderersFactory.EXTENSION_RENDERER_MODE_PREFER;
renderersFactory = new DefaultRenderersFactory(this) .setExtensionRendererMode(extensionRendererMode);
// Create a progressive media source pointing to a stream uri.
mediaSource = new ProgressiveMediaSource.Factory(dataSourceFactory)
.createMediaSource(Uri.parse(url_to_stream));
// Create a player instance.
simpleExoPlayer = new SimpleExoPlayer.Builder(this,renderersFactory).setLoadControl(loadControl).build();
// Prepare the player with the media source.
simpleExoPlayer.prepare(mediaSource, true, true);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With