I am trying to set libVLC video in android Java as like as it adapts in entire SurfaceView. Actually I have set:
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center">
<SurfaceView
android:id="@+id/surfaceview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<org.videolan.libvlc.util.VLCVideoLayout
android:id="@+id/video_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center" />
</FrameLayout>
and I run libVCL as:
surface_view = (SurfaceView) popupcamvideoView.findViewById(R.id.surfaceview);
ViewGroup.LayoutParams videoParams = surface_view.getLayoutParams();
videoParams.width = displayMetrics.widthPixels;
videoParams.height = displayMetrics.heightPixels;
libVLC = new LibVLC(surface_view.getContext(), args);
mediaPlayer = new MediaPlayer(libVLC);
mVideoLayout = popupcamvideoView.findViewById(R.id.video_layout);
mediaPlayer.attachViews(mVideoLayout, null, ENABLE_SUBTITLES, USE_TEXTURE_VIEW);
mediaPlayer.setVideoScale(MediaPlayer.ScaleType.SURFACE_ORIGINAL);
media = new Media(libVLC, Uri.parse(url_nedia.toString()));
media.addOption("-vvv");
media.addOption(":network-caching="+mNetworkCaching);
media.addOption("--drop-late-frames");
media.addOption("--no-audio-time-stretch");
media.addOption("--vout=android-display");
media.addOption("--fullscreen");
mediaPlayer.setMedia(media);
media.release();
mediaPlayer.play();
but in this way I see as like:
which it looks like small, and I’d like to adapt to the entire SurfaceView as rotated so at least I can see it better as like as:
I tried to change SURFACE_ORIGINAL to SURFACE_FIT_SCREEN and it looks like filling the entire SurfaceView but it didn’t even rotated and it is like cropped and showing the middle part of the video…. it should be rotated to adapt the entire resolution video to the entire SurfaceView…
I even tried to add:
media.addOption("--video-filter");
media.addOption("rotate");
media.addOption("--rotate-angle");
media.addOption("90");
before the --fullscreen
option , but it didn’t rotate and adapt the original resolution video to the entire SurfaceView at all….how I could do that? Any direction is appreciated… thanks in advance to all! Cheers!