我是安卓开发的新手,我正在努力实现libstreaming example 3 sample project。所有的工作都很好,除了我还没有能够改变视频预览的方向到实际。无论我改变什么设置,它都拒绝旋转,保持景观模式。我知道实现纵向定向是可能的,因为spydroid使用displays并在纵向定向中显示任何帮助都是非常感谢的。
我的相关代码:
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();发布于 2014-10-15 06:06:20
在示例3代码中,似乎manifest..just中的方向是固定的,将其保留为空(甚至不要设置为纵向)。
<activity
android:windowSoftInputMode="stateHidden"
android:name="net.majorkernelpanic.example3.MainActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.DeviceDefault.Wallpaper.NoTitleBar">这将允许您的活动改变方向。
若要强制定向,请在onCreate末尾( selectQuality();行后面)添加以下行
mSession.setPreviewOrientation(90);
mSession.configure();发布于 2015-07-03 13:42:13
查看“library”库,然后转到:
https://stackoverflow.com/questions/26329869
复制相似问题