A module that helps in capturing Screen, Internal Audio (Only starting from Android P), Mic Audio
We shall follow a Modular Mechanism to implement the flow of the App. This makes the App easier to scale
Minimal/Modular/Straightforward architecture as this is supposed to be a demo app
| Feature Name | Description |
|---|---|
screen_record | Has a ChannelCatchActivity responsible for channelcatch Module and implement Screen Recording |
| Module Name | Description |
|---|---|
app | This is the main of the Application, this run and keeps activities intact |
channelcatch | This is the module responsible for recording screen, internal audio, mic audio based on the Current API Version |
plinth | Base Components Supplier for the whole app |
| bucker (not implemented) | A Logger that logs all crashes, debugs, analytics, etc |
stockpile | Repo for all the UI templates |
channelcatch module is a independent module and can be used in any app. Can be made public and used out of the box for any app. How to implement channelcatch module?
Following needs to be added in the app's AndroidManifest root
<uses-permissionandroid:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permissionandroid:name="android.permission.RECORD_AUDIO" />
<uses-permissionandroid:name="android.permission.FOREGROUND_SERVICE" /> <serviceandroid:name="com.specimen.modular.channelcatch.service.ChannelCatchForegroundService"android:foregroundServiceType="mediaProjection" />Following needs to be added in your activity
privateval channelCaptureHelper by lazy { ChannelCaptureHelper(this, channelCatchCallback) }
privateval channelCatchCallback by lazy {
object:ChannelCatchCallback {
overridefunaskPermission() {
}
overridefunaskForMediaCapturePermission(intent:Intent?, requestCode:Int) {
this@ChannelCaptureActivity.startActivityForResult(intent, requestCode)
}
overridefunstartedProjection() {
record.setBackgroundColor(ContextCompat.getColor(this@ChannelCaptureActivity, R.color.colorPrimary))
record.text = getString(R.string.record_stop)
}
overridefunstoppedProjection() {
record.setBackgroundColor(ContextCompat.getColor(this@ChannelCaptureActivity, R.color.green_400))
record.text = getString(R.string.record_start)
}
}
}
Start Capturing Screen
channelCaptureHelper.start(application)End Capturing Screen
channelCaptureHelper.end(application)Default RecordSpeification. You can create a new RecordSpecification object to change any of these
data classRecorderSpecification(
valwidth:Int = 720,
valheight:Int = 1280,
valv_bitrate:Int = 512 * 1000,
valframeRate:Int = 30,
valv_encoding:Int = MediaRecorder.VideoEncoder.H264,
vala_encoding:Int = MediaRecorder.AudioEncoder.AMR_NB,
valfilePattern:String = "dd-MM-yyyy-hh_mm_ss",
valv_filePrefix:String = "Record_",
vala_filePrefix:String = "Capture_",
valv_ext:String = ".mp4",
vala_ext:String = ".pcm",
valv_source:Int = MediaRecorder.VideoSource.SURFACE,
vala_source:Int = MediaRecorder.AudioSource.MIC,
valoutputFormat:Int = MediaRecorder.OutputFormat.THREE_GPP,
valrequestCode:Int = 1001
)- Why is it not working for me? - dependency issue maybe, create an issue if it doesn't work
- Will it support other types of media? - Yes, all kinds but that will take time
Open for contributors! Don't be shy. 😁 Feel free to open issues/pull requests to help me improve this project.
