android – 如何旋转libstreaming Video Preview?

前端之家收集整理的这篇文章主要介绍了android – 如何旋转libstreaming Video Preview?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我是 Android开发的菜鸟,我正在尝试实现 libstreaming example 3 sample project.一切正常,但我无法将视频预览的方向更改为prtrait.无论我改变什么设置,它都会拒绝旋转并保持横向模式.我知道可以实现纵向方向,因为 spydroid使用自由选择流和纵向显示任何帮助都非常感谢.

我的相关代码

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();

解决方法

在示例3代码中,似乎方向在清单中是固定的.只需将其留空(甚至不设置为纵向)
<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();
原文链接:https://www.f2er.com/android/309687.html

猜你在找的Android相关文章