I am a noob to android development and I am trying to implement the libstreaming example 3 sample project. Everything works fine except that I haven't been able to change the orientation of the the video preview to prtrait. No matter what settings I change it refuses to rotate and stays in landscape mode. I know that it is possible to achieve portrait orientation because spydroid uses libstreaming and displays in portrait orientation Any help is greatly appreciated.
My relevant code:
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); //<--Does Nothing
// Configures the SessionBuilder
mSession = SessionBuilder.getInstance()
.setContext(getApplicationContext())
.setAudioEncoder(SessionBuilder.AUDIO_AAC)
.setAudioQuality(new AudioQuality(8000, 16000))
.setVideoEncoder(SessionBuilder.VIDEO_H264)
.setSurfaceView(mSurfaceView)
.setPreviewOrientation(90) //<--Does Nothing
.setCallback(this)
.build();
In the example 3 code, it seems the orientation is fixed in the manifest..just leave it out empty (do not even set to portrait)
<activity
android:windowSoftInputMode="stateHidden"
android:name="net.majorkernelpanic.example3.MainActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.DeviceDefault.Wallpaper.NoTitleBar">
This will allow your activity to change orientation.
To force the orientation, add the below lines at the end of onCreate
(after selectQuality();
line)
mSession.setPreviewOrientation(90);
mSession.configure();
Explore "libstreaming" library then go to:
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