My ultimate goal is to figure out how to record from an Android camera & save the video, so I can then use that video file later in my app.
I'm trying to use StartScreenRecording to screen capture on Android. I figured out how to save the video to a custom Android directory. I've also had success showing the camera on-screen using SetDeviceCameraToImage. I figured that if I combine the two, I should be able to capture video from the camera.
Except its not working for me. Whenever I run the following, the app abruptly shuts down right after the first Sync() following StarScreenRecording().
// Show camera on screen
SetDeviceCameraToImage(0,1)
CreateSprite(1,1)
SetSpriteSize(1,GetVirtualWidth(),GetVirtualHeight())
// Wait for user
While GetPointerPressed()=0
Print("Press to start recording")
Sync()
EndWhile
// Record screen
StartScreenRecording("raw:/sdcard/Videos/testcapcamera.mp4", 1)
g=0
While g<100
g=g+1
Print(g)
Sync()
EndWhile
StopScreenRecording()
// All done
For g=1 to 90
Print("Done!")
Sync()
Next
SetDeviceCameraToImage(0,0)
To be clear: if I disable EITHER the SetDeviceCameraToImage() OR the StartScreenRecording() functionality, the other one works as expected. I'm only having a problem trying to do both together.
Are these two abilities that just weren't designed to work together? If so, is there another way of capturing the camera to a video file?