如何旋转libstreaming Video Preview?

B. *_*ney 6 video android orientation surfaceview

我是android开发的菜鸟 ,我正在尝试实现libstreaming 示例3示例项目.一切正常,但我无法将视频预览的方向更改为prtrait.无论我改变什么设置,它都会拒绝旋转并保持横向模式.我知道可以实现纵向方向,因为spydroid使用libstreaming并以纵向方式显示任何帮助都非常感谢.

我的相关代码:

    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();
Run Code Online (Sandbox Code Playgroud)

ash*_*oke 4

在示例 3 代码中,方向似乎在清单中是固定的..只需将其保留为空(甚至不要设置为纵向)

        <activity
        android:windowSoftInputMode="stateHidden"
        android:name="net.majorkernelpanic.example3.MainActivity"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.DeviceDefault.Wallpaper.NoTitleBar">
Run Code Online (Sandbox Code Playgroud)

这将使您的活动改变方向。

要强制方向,请在onCreateselectQuality();行后)的末尾添加以下行

    mSession.setPreviewOrientation(90);
    mSession.configure();
Run Code Online (Sandbox Code Playgroud)