As we spoke about last time, there were two problems with my custom S4 camera app:

  1. No way to stop the recording, you had to wait for the 1 or 3 minute timer to elapse.
  2. No audio was recorded.

Well, I haven’t fixed everything yet, but I was able to fix issue #1, stopping the recording. Essentially, I added a button which was invisible all of the time, unless you were recording. Once you start recording (still for 1 or 3 minutes), the stop recording button will become visible in the corner of the screen.

Pressing that stop recording button causes a super user command to be sent using pkill -2 to kill the screenrecord function. A -2 pkill command is the same as a ^c (control-c) command. That is a very nice command which tells it to wrap up and then stop, but do so now! I tried other pkill commands, which literally kill the process in a less than nice fashion, but when I do that, the video is not “ended” properly and becomes unreadable. This method allows the screenrecord function to properly close writing to the video so it is readable!

You can check out the changes and download the latest version on my Github:

https://github.com/alaskalinuxuser/S4camera_app

https://github.com/alaskalinuxuser/S4camera_app/commit/51f0934ee7eed612f1fd168e20b27afc148e6a17

Linux – keep it simple.

Leave a Reply

Your email address will not be published. Required fields are marked *