I am not sure you can do this because you are opening third party app to play your video and may be that player not providing you the control to handle orientation by your code.
You can achieve your result by below code
Create a layout
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/frameLayoutRoot"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<VideoView
android:id="@+id/surfaceViewFrame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center">
</VideoView>
</RelativeLayout>
now Create a new activity/playeractivity and set the above layout in setcontent view
//In OnCreate
VideoView videoView = (VideoView)findViewById(R.id.surfaceViewFrame);
videoView.setVideoURI(Uri.parse(yoururl/local/server));
videoView.start();
progressBarWait.setVisibility(View.VISIBLE);
videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(final MediaPlayer mp) {
mp.start();
mp.setOnVideoSizeChangedListener(new MediaPlayer.OnVideoSizeChangedListener() {
@Override
public void onVideoSizeChanged(MediaPlayer mediaPlayer, int i, int i2) {
// Log.e(TAG, "Changed");
progressBarWait.setVisibility(View.GONE);
mp.start();
}
});
}
});
videoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
public void onCompletion(MediaPlayer mp) {
finish();
}
});
And in Menifest.xml declear your activity with orientation
<activity android:name=".YourPlayerActivity"
android:screenOrientation="portrait/landscape"/>