sinch视频聊天没有显示本地视图或远程视图

时间:2017-03-28 11:01:15

标签: android sinch android-sinch-api

我已经在我的基于sinch视频推送样本的应用程序中集成了sinch视频聊天

本地视图和远程视图仅显示黑屏,不显示任何内容,并在后台生成此崩溃

03-28 12:02:59.371 16607-19169/com.forsale.forsale E/Logging: VideoCapturerAndroid: java.lang.RuntimeException: Fail to connect to camera service
                                                              at android.hardware.Camera.<init>(Camera.java:568)
                                                              at android.hardware.Camera.open(Camera.java:405)
                                                              at org.webrtc.sinch.VideoCapturerAndroid.startCaptureOnCameraThread(VideoCapturerAndroid.java:450)
                                                              at org.webrtc.sinch.VideoCapturerAndroid.access$1100(VideoCapturerAndroid.java:47)
                                                              at org.webrtc.sinch.VideoCapturerAndroid$7.run(VideoCapturerAndroid.java:460)
                                                              at android.os.Handler.handleCallback(Handler.java:739)
                                                              at android.os.Handler.dispatchMessage(Handler.java:95)
                                                              at android.os.Looper.loop(Looper.java:158)
                                                              at android.os.HandlerThread.run(HandlerThread.java:61)

任何人都可以帮忙吗?

1 个答案:

答案 0 :(得分:3)

内部清单文件:

<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-permission android:name="android.permission.CAMERA"></uses-permission>

不要忘记请求此处描述的权限:

https://developer.android.com/training/permissions/requesting.html

简而言之:

    if (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
        ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.CAMERA}, 50);
}    else {       


   startCamera();

}