ScreenRecorder: An extension for screen recording

1. Introduction

Screen Recorder is an extension which offers a set of tools to record screen customizable features

Latest Version: 2
Released: 2020-07-10T18:30:00Z
Last Updated: 2024-05-01T18:30:00Z
Requires: Api 21 (and Api 24 for Pause and Resume methods)
Permissions: android.permission.WRITE_EXTERNAL_STORAGE and android.permission.RECORD_AUDIO (and android.permission.FOREGROUND_SERVICE for Api 29 and above) , android.permission.POST_NOTIFICATIONS (for Android 13 and above)

Key Features:

  • Simple yet feature-rich screen recording with a lot of customization options
  • Keep recording screen even after app is closed
  • Control recording like Stop, Resume and Pause without opening app, from Notification itself
  • Proper error and information handling with GotInfo and ErrorOccurred events
  • Clicking notification will open app if not running otherwise bring it to front so there won't be multiple instances of screen running at a time

2. Blocks

image

3. Documentation

Events

ErrorOccurredEvent invoked when an error occurs while recording
error | text
GotInfoEvent invoked when an informational event occurs while recording
info | text
RecordingStartedEvent indicating that recording has started.
RecordingCompletedEvent indicating that recording has completed.
filePath | text

Methods

ResetPropertiesSets property values according to video quality.
GetSupportedProfilesReturns a list of supported video quality profiles
GetAudioEncodersReturns a dictionary of all Audio Encoders in which encoder's name is key. All audio encoders might not be compatible with video encoders.
GetVideoEncodersReturns a dictionary of all Video Encoders in which encoder's name is key.All video encoders might not be compatible with audio encoders.
MinimizeAppMinimizes current app
InitializeRecorderPrepares the recorder to begin capturing screen
PauseRecordingPauses recording.It does nothing if the recording is already paused.
ResumeRecordingResumes recording.It does nothing if the recording is not paused.
StartRecordingStarts capturing the screen and saving to file specified.
IsRecordingReturns whether recorder is recording screen or not
StopRecordingStops the recording and resets the recorder to its idle state.After calling this method, you will have to initialize recorder again.

Properties

NotificationTextSets notification text
Property Type : write-only
Accepts : text
NotificationTitleSets notification title
Property Type : write-only
Accepts : text
NotificationIconSets notification icon
Property Type : write-only
Accepts : text
AudioEncoderReturns the audio encoder used to encode audio recording.
Property Type : read-write
Accepts : number
VideoEncoderReturns the video encoder used to encode video recording.
Property Type : read-write
Accepts : number
RecordAudioSets whether MIC audio should be recorded or not
Property Type : write-only
Accepts : boolean
MaxDurationReturns the maximum duration of recording.
Property Type : read-write
Accepts : number
MaxFileSizeReturns the maximum filesize (in bytes)
Property Type : read-write
Accepts : number
VideoEncodingRateReturns the video encoding bit rate.
Property Type : read-write
Accepts : number
VideoFormatReturns format of output file.
Property Type : read-write
Accepts : number
FileNameReturns the file path of output file.
Property Type : read-write
Accepts : text
FrameRateReturns the frame rate of the video to be captured.
Property Type : read-write
Accepts : number
VideoQualityReturns the video qaulity profile.
Property Type : read-write
Accepts : number
UseDefaultProfileReturns whether recorder should use default profile or not.
Property Type : read-write
Accepts : boolean
AudioEncodingBitRateReturns the audio encoding bit rate for recording.
Property Type : read-write
Accepts : number
ApiVersionReturns Android Version code
Property Type : read-only
Accepts : number
ActionButtonsSets whether Stop, Pause and Resume buttons should be shown in notification or not
Property Type : write-only
Accepts : boolean

4. Downloads

Kindly consider donating some amount to keep me motivated :heart:

5. Additional Resources

Audio Encoder: MediaRecorder.AudioEncoder
Video Encoder: MediaRecorder.VideoEncoder
Output Format: MediaRecorder.OutputFormat
Video Quality: Camcorder Profile

Note: Not every video/audio encoder supports all output formats.
This can help you to chose appropriate properties:
Media Formats

Demo Video:

6. Updates/Bug Fixes

ChangeLog Version 1.2

ScreenRecorder: An extension for screen recording - #20 by vknow360

ChangeLog Version 1.3
  • Fixed UI Not Responding error
ChangeLog Version 1.4
  • Extension is now compatible with latest android versions
ChangeLog Version 1.5
  • Fixed bugs which were occurring on older devices
ChangeLog Version 2

New Blocks:
image
image
image

Changes:

  • GetSupportedProfiles now returns dictionary instead of list
  • Screen Recording notification can be customised now
    image
  • Service keeps running even when app is closed.
    On next app launch, you'll be able to get recording status.
  • Clicking on recording notification will (i) open app if not running (ii) bring app to front if already running
    It'll prevent multiple instances to be present at a time

Extension has been completely re-written so there are a lot of internal behavioral changes to improve user experience and also to omit possible Runtime Errors

Hope it helps! :grin:

30 Likes

Great Extension.

5 Likes

nice extension @vknow360

5 Likes

Does it record screen even if app is closed.?

1 Like

No.
App should be running in background.

5 Likes

That's impressive! It helped me a lot, thank you very much, this is amazing.

5 Likes

Hi @Hyperfect Welcome
Glad you liked it :heart_eyes:

5 Likes

This is fantastic!!! I'm new to App Inventor, and coding in general, and this extension is very powerful while being simple! Great job!!! :clap: :clap: :clap:

Thanks for sharing!

Cheers!

4 Likes

Can you add a event like on recorder initialized

3 Likes

The extension works synchronously so there is no need to add that event.
Since you initialize the recorder so you can perform specific task just after that.

6 Likes

it means it initialeses instantly or takes some time?

2 Likes

It takes some time and stops main thread for that period because it works synchronously.

However if any error occurs then Error Occurred event will be triggered.

4 Likes

have you created this Extension using @UsesServices ??

1 Like

No, this extension has nothing to do with services.

Edit: Now it uses Services.

3 Likes

use like some floating views when app runs in background

3 Likes

amazing @vknow360!!!:smile:

3 Likes

Did not work for me in the background

2 Likes

have u used wat i said?

3 Likes

ChangeLog Version 1.2

New blocks
image

Bug Fixes

  • Fixed bug which was crashing app on Android 10 (Thanks to @Angelo_Angius for reporting the bug and testing the beta version )
  • Minor bug fixes

Changes

  • Some internal changes (Set min sdk to 21)
  • Changed default file path for Android 10 (it is stored in Recordings dir of ASD)

Known Bugs/Issues

  • Some events are getting invoked multiple times

Aix
com.sunny.ScreenRecorder.aix (31.7 KB)

Aia
ScreenRecorder.aia (72.6 KB)

Note : In case anything goes wrong then simply search for Logging.txt in the file manager.



Merry Christmas :christmas_tree: :partying_face:

15 Likes

How do I make it so only the phone/device output audio is recorded? I do not want the phone microphone to record sound. Only sound coming from the phone/device

1 Like