【问题标题】:The camera is in use by another app相机正在被另一个应用程序使用
【发布时间】:2016-09-24 07:02:55
【问题描述】:

我正在使用 opentok 开发一个 webRTC 应用程序。该应用程序运行良好。我将应用程序转换为库并通过将其添加到另一个项目来启动库活动。该应用程序正在连接到服务器,但相机未打开。我收到如下相机错误

E/opentok-videocapturer: The camera is in use by another app
                                                                 java.lang.RuntimeException: Fail to connect to camera service
                                                                     at android.hardware.Camera.<init>(Camera.java:518)
                                                                     at android.hardware.Camera.open(Camera.java:360)
                                                                     at com.opentok.android.DefaultVideoCapturer.init(DefaultVideoCapturer.java:110)
                                                                     at com.opentok.android.BaseVideoCapturer.initTrap(BaseVideoCapturer.java:223) 

【问题讨论】:

标签: android camera opentok


【解决方案1】:
public boolean isCameraUsebyApp() {
        Camera camera = null;
        try {
            camera = Camera.open();
        }
        catch (RuntimeException e)
        {
            return true;
        }
        finally
        {
            if (camera != null)
            {
                camera.release();
            }
        }
        return false;
    }

【讨论】:

    猜你喜欢
    • 2017-11-12
    • 2018-01-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-24
    • 2011-04-13
    相关资源
    最近更新 更多