I'm having trouble getting the Camera to work on one of my devices, it worked in previous versions, though. The device is an Alcatel One Touch Pop 3 (Android 4.3), I know it's not the most popular device, but it might happen on other devices, too. For further investigation I attached a log.
According to the log, it seems that startCapture failed from Android native, probably because that we've updated the WebRTC stack behind P2P SDK.
Another thing is that have you made your own P2P app or just used the default sample?
That's possible. We have not tested the Alcatel One Touch Pop 3.
And since we upgraded the WebRTC stack as I mentioned, your very device might not be compatible with latest Android Camera API.
Could you test this API on your device?
Sure, just tell me how to do so and I'll give it a try.
EDIT: Just had the same error with a Galaxy Note 3 (Custom Rom).
EDIT2: So I've tested it on some more devices and it seems that only one device is able to start the Camera: Vuzix M100. It has just on physical camera attached (BACK) so that differs it from the other Devices (Note 3, Alcatel Pop 3, Samsung Galaxy Tab P3100). BTW:
I tried to set the camera-id (both front and back) myself, but it did not do the trick.
msp = new LocalCameraStreamParameters(true, true); msp.setCamera(LocalCameraStreamParameters.CameraType.BACK); localStream = new LocalCameraStream(msp);
EDIT3: Hopefully last edit^^
I found the flaw: somewhere in your compiled sources you're calling the camera with a default resolution and it seems it's choosing one which is not supported by most devices. By manually setting a resolution makes the camera work again.
msp = new LocalCameraStreamParameters(true, true); msp.setResolution(800,600); localStream = new LocalCameraStream(msp);
Edit 4: I'm still having trouble and i cannot explain, why...
When publishing media I'm calling this codeblock, just like in your example app:
msp = new LocalCameraStreamParameters(true, true); msp.setCamera(LocalCameraStreamParameters.CameraType.BACK); msp.setResolution(800, 600); localStream = new LocalCameraStream(msp); localStream.attach(localView);
This runs on every device except Vuzix M100 o.O
Funny thing is, it fixes the issue by applying a breakpoint in LocalCameraStreamParameters.class.
Position Breakpoint to this line:
String deviceName = "Camera" + this.cameraId + ",Facing " + e + ", Orientation " + info.orientation;
In the next line the capturer is getting created and after that it's getting checked if it's null. It's always null during runtime, but when I look at it (breaking), it's working. Just like a quantum particle^^ The other thing is, by applying a breakpoint ONLY in the exception-blocks, it's again not working at all.
For devices that have issue, try to use default resolution.
And you can first list phone’s supported preview resolutions, and then explicitly set solution by localCameraStreamParameters.setResolution(int, int).