Screen Recording Won't Turn Off

Sometimes but not always, when I start screen recording, it won’t turn off again when I touch the red camera.

Perhaps relatedly, sometimes it prompts for permission before starting, sometimes it doesn’t. Sometimes it prompts for save, sometimes it doesn’t.

What would be good would be always to prompt to start, always to stop when you touch it, and always to prompt for save.

What would be super-good would be if the recording prompt had an option to reset the program, so you could get a recording from the beginning without some extra stuff at the beginning.

Am I missing some clever way to make this work? The unreliability is making it really hard to write articles that include little video snippets.


@RonJeffries I think you’ll get the prompt for permission only the first time a program is started after Codea is started. After that you can start the program without the prompt. If you close Codea, then you’ll get the permission prompt again the first time the program is started.

Well, that is IMO odd. What is less desirable is that I can’t stop the recordings at all after the first one. Touching the red camera does nothing.

Further to this: Put this in the program:

function touched(touch)
    if isRecording() then stopRecording() else startRecording() end

Plus in draw, I put an if that draws a little green dot when isRecording().

Upon running the program, the first screen touch brings up the permission dialog. The green dot illuminates, as does the camera and the recording notice in the sidebar. The second brings up the save dialog and stops recording as one would expect.

Thereafter, even with new runs, even with closing the program file and reopening, touching the screen does not start recording. Once, I started it by touching the camera and it did light up, but then neither touching the screen, nor the camera, would stop it.

It’s not at all clear what has to happen to get it back in the right mode.

Further still: resetting the program with the circle restart button seems to confuse it. If I do that with the program running, it will not let me stop it again. An init problem, I suspect.

Yes, resetting definitely seems to cause it. (I have also learned that without checking the touch state the screen touching approach is fraught but it helped me learn what I’ve learned so far. :slight_smile:

@RonJeffries I’m using Codea version 2.7.5 (145) and I’m not having any trouble with the camera icon. I touch the camera, it turns red and starts recording. I touch it again and it turns black and the save recording screen pops up. I’ve done that several times without any trouble. I’ve noticed that if I have trouble with touching the screen, I’ll lick the tip of my finger to get it a little moist. If my finger is really dry, I have trouble with screen touches in any app.

@RonJeffries you might want to catch a specific touch state to trigger the start and stop recording rather than toggling for any touch event.

function touched(touch)
    if isRecording() then stopRecording() else startRecording() end

This will also trigger if you have your finger on the screen and move it. Maybe a better alternative would be:

function touched(touch)
    if isRecording() and touch.state==ENDED then stopRecording() else startRecording() end

This will now only trigger when your finger is removed. For completeness you would probably also want to track multiple touches but guessing that’s overkill here - just make sure you only use one finger on the screen at a time

@dave1707 try starting it, then resetting the program (the round arrow button). That’s what seems to break it.

@West Yes, that would work better, though it was sufficient to show me that the bug persists either way.

@RonJeffries I’m not sure what kind of state I got into, but I could start and stop the recording OK by pressing the camera or by program control. The only problem was I couldn’t get the save video screen to show to save the video. I closed the program and started it, but that didn’t help. I closed and opened Codea but that didn’t help either. I finally got it working again by doing a recording with the iOS camera. It looks like there’s something wrong with the Codea camera code.

@dave1707 yes, that’s why i filed this under bugs :slight_smile:

These bugs started happening when we moved from our custom screen recorder to the new ReplayKit API, which is supposed to use the same system as the general iOS screen recording

I’ve looked into this and as far as I can tell we’re using the API as intended, but it will often do things like fail to present the recording finished UI / fail to report the correct recording state. And sometimes you need to restart your device for it to function correctly again

I’d recommend using the system-wide screen recording for now (open Control Center and tap the record button — you can add the record button to Control Center from the Settings app)