padvou Active Member Licensed User Longtime User Jan 25, 2017 #1 Hello, sometimes the camera preview freezes. Is there some way I could catch this freezing in my application, so that I can act on this? Thank you.
Hello, sometimes the camera preview freezes. Is there some way I could catch this freezing in my application, so that I can act on this? Thank you.
JordiCP Expert Licensed User Longtime User Jan 25, 2017 #2 If you don't get an error I don't think that the camera has freezed. Possibly you have taken a picture, or called stoppreview for some other reason, and not called startpreview again I would check if this happens with cameraEx example without modifications. Also, put a Log() in camera_preview event of your app to see if the event keeps firing (which will mean that the preview is running). If the later is true, then perhaps you have another view with the "latest shot" on top of the preview panel. Upvote 0
If you don't get an error I don't think that the camera has freezed. Possibly you have taken a picture, or called stoppreview for some other reason, and not called startpreview again I would check if this happens with cameraEx example without modifications. Also, put a Log() in camera_preview event of your app to see if the event keeps firing (which will mean that the preview is running). If the later is true, then perhaps you have another view with the "latest shot" on top of the preview panel.
padvou Active Member Licensed User Longtime User Jan 25, 2017 #3 I changed the preview sub like this: Code: Sub Camera_Preview (Data() As Byte) Try Main.CamData=Main.CamData + Data.Length If SubExists(target, event & "_preview") Then CallSub2(target, event & "_preview", Data) End If Catch ToastMessageShow(LastException,False) End Try End Sub In the main activity I check if the CamData value, which is numeric, stops incrementing. This would mean that the preview is frozen. If this is the case, I release the camera and re-initialize it. It's a little dirty, but I checked and it seems to work. Upvote 0
I changed the preview sub like this: Code: Sub Camera_Preview (Data() As Byte) Try Main.CamData=Main.CamData + Data.Length If SubExists(target, event & "_preview") Then CallSub2(target, event & "_preview", Data) End If Catch ToastMessageShow(LastException,False) End Try End Sub In the main activity I check if the CamData value, which is numeric, stops incrementing. This would mean that the preview is frozen. If this is the case, I release the camera and re-initialize it. It's a little dirty, but I checked and it seems to work.
DonManfred Expert Licensed User Longtime User Jan 25, 2017 #4 i guess the running activity (with the preview) is not the main activity, right? Did you checked if the main act is being killed by android in the meantime? Probably you can use the starter service for this "counter" and set the value of the starter instead of avalue in a paused activity And in main - for sure - you should check the starter service value then Upvote 0
i guess the running activity (with the preview) is not the main activity, right? Did you checked if the main act is being killed by android in the meantime? Probably you can use the starter service for this "counter" and set the value of the starter instead of avalue in a paused activity And in main - for sure - you should check the starter service value then
padvou Active Member Licensed User Longtime User Jan 25, 2017 #5 DonManfred said: i guess the running activity (with the preview) is not the main activity, right? Did you checked if the main act is being killed by android in the meantime? Probably you can use the starter service for this "counter" and set the value of the starter instead of avalue in a paused activity And in main - for sure - you should check the starter service value then Click to expand... It seems better to use the starter service as you suggest, I should read the documentation, which I havent so far. The main activity is not killed, I checked. It's definitely a camera driver issue, because it happens only when I change the Whitebalance of the camera and only for a specific device. Upvote 0
DonManfred said: i guess the running activity (with the preview) is not the main activity, right? Did you checked if the main act is being killed by android in the meantime? Probably you can use the starter service for this "counter" and set the value of the starter instead of avalue in a paused activity And in main - for sure - you should check the starter service value then Click to expand... It seems better to use the starter service as you suggest, I should read the documentation, which I havent so far. The main activity is not killed, I checked. It's definitely a camera driver issue, because it happens only when I change the Whitebalance of the camera and only for a specific device.