yasea icon indicating copy to clipboard operation
yasea copied to clipboard

Fail to connect to camera service

Open Kristaps89 opened this issue 7 years ago • 6 comments

I got this error. App is working on Samsung but that is crashed on another phone. Caused by java.lang.RuntimeException: Fail to connect to camera service at android.hardware.Camera.(Camera.java:568) at android.hardware.Camera.open(Camera.java:405) at net.ossrs.yasea.SrsCameraView.openCamera(SrsCameraView.java:356) at net.ossrs.yasea.SrsCameraView.setPreviewResolution(SrsCameraView.java:141) at net.ossrs.yasea.SrsPublisher.setPreviewResolution(SrsPublisher.java:229)

in SrsCameraView class, I see private Camera mCamera; I think that this bug is related with using deprecated Camera sdk. please let me know how can I fix it.

Kristaps89 avatar Sep 13 '17 01:09 Kristaps89

No, that is because your camera does not support preview resolution as 640x360. Try 640x480 in MainActivity.java

begeekmyfriend avatar Sep 13 '17 02:09 begeekmyfriend

com.thinapp.peepo_issue_1_crash_59B8A2530391000125807D639FDDC082_b1828635983111e7980956847afe9799_0_v2.txt

I changed resolution as 640x480. but app is still crashed. Phone is Samsung Galaxy Sol, android version is 6.0.1

Kristaps89 avatar Sep 13 '17 03:09 Kristaps89

Please invoke mCamera.getParameters().getSupportedPreviewSizes() and mCamera.getParameters().getSupportedPictureSizes to find out what is the proper preview resolution should be set.

begeekmyfriend avatar Sep 13 '17 07:09 begeekmyfriend

Why doesn't this sdk show any permission dialog such as camera access.? I tried with default resolution but app is crashed. it seems that app is crashed because access on camera without any permission.

Kristaps89 avatar Sep 13 '17 11:09 Kristaps89

OK, I resolved this problem. I call Manifest.permission.CAMERA and Manifest.permission.RECORD_AUDIO manually. now it works fine.

Kristaps89 avatar Sep 13 '17 13:09 Kristaps89

OK, I resolved this problem. I call Manifest.permission.CAMERA and Manifest.permission.RECORD_AUDIO manually. now it works fine.

I use the same way to resolve my question.

Mgldog avatar Feb 26 '20 07:02 Mgldog