I've gone through many answers here but no luck. below is my code :
private PlayerView playerView;
private SimpleExoPlayer player;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
playerView = findViewById(R.id.player_view);
}
@Override
protected void onStart() {
super.onStart();
player = ExoPlayerFactory.newSimpleInstance(this, new DefaultTrackSelector());
playerView.setPlayer(player);
Uri uri = Uri.parse("videoLink");
DefaultDataSourceFactory dataSourceFactory = new DefaultDataSourceFactory(this, Util.getUserAgent(this, "ExoPlayerDemo"));
ExtractorMediaSource mediaSource = new ExtractorMediaSource.Factory(dataSourceFactory).createMediaSource(uri);
player.prepare(mediaSource);
player.setPlayWhenReady(true);
}
and xml is :
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.exoplayer2.ui.PlayerView
android:id="@+id/player_view"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
I want the video to be opened always in full-screen mode..I'm not providing any button to make it full-screen. ExoPlayer is such a popular library for video streaming so I wonder why it has still not released an easy way for this so common feature. Any help is appreciated. Thanks.