{"id":13604095,"url":"https://github.com/HBiSoft/HBRecorder","last_synced_at":"2025-04-11T22:32:38.000Z","repository":{"id":39450336,"uuid":"202295008","full_name":"HBiSoft/HBRecorder","owner":"HBiSoft","description":"Lightweight screen recording Android library","archived":false,"fork":false,"pushed_at":"2024-12-31T10:41:47.000Z","size":27507,"stargazers_count":436,"open_issues_count":0,"forks_count":140,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-12-31T11:30:36.474Z","etag":null,"topics":["android","android-audio","android-library","android-media-projection","android-screen-recorder","android-screencast","android-video"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HBiSoft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"License.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-08-14T07:11:00.000Z","updated_at":"2024-12-31T10:41:51.000Z","dependencies_parsed_at":"2024-11-07T08:33:58.826Z","dependency_job_id":"417605b5-ad0b-4526-b69d-4a1c9dbf70dc","html_url":"https://github.com/HBiSoft/HBRecorder","commit_stats":null,"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HBiSoft%2FHBRecorder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HBiSoft%2FHBRecorder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HBiSoft%2FHBRecorder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HBiSoft%2FHBRecorder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HBiSoft","download_url":"https://codeload.github.com/HBiSoft/HBRecorder/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248489892,"owners_count":21112657,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","android-audio","android-library","android-media-projection","android-screen-recorder","android-screencast","android-video"],"created_at":"2024-08-01T19:00:39.840Z","updated_at":"2025-04-11T22:32:32.987Z","avatar_url":"https://github.com/HBiSoft.png","language":"Java","funding_links":["https://www.buymeacoffee.com/HBiSoft"],"categories":["Java"],"sub_categories":[],"readme":"**\u003cp align=\"center\"\u003eCreating and maintaining a library like this requires a significant amount of time and effort.\u003c/p\u003e**\n\n**\u003cp align=\"center\"\u003eIf you’d like to show your appreciation, you can do so below:\u003c/p\u003e**\n\n\u003cp align=\"center\"\u003e\u003ca href=\"https://www.buymeacoffee.com/HBiSoft\" target=\"_blank\" \u003e\u003cimg src=\"https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png\" alt=\"Buy Me A Coffee\" style=\"height: 41px !important;width: 164px !important;box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;\" \u003e\u003c/a\u003e\u003c/p\u003e\n\n---\n\u003c/br\u003e\n\n# HBRecorder\n[![](https://jitpack.io/v/HBiSoft/HBRecorder.svg)](https://jitpack.io/#HBiSoft/HBRecorder)\n[![Android Arsenal]( https://img.shields.io/badge/Android%20Arsenal-HBRecorder-green.svg?style=flat )]( https://android-arsenal.com/details/1/7897 )\n\n\u003cp align=\"center\"\u003eLightweight screen and audio recording Android library \u003c/br\u003e\u003c/br\u003e\u003cb\u003eRequires API level 21\u003e\u003c/b\u003e\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"https://user-images.githubusercontent.com/35602540/63006287-7df6e500-be7e-11e9-82b6-40814d8201df.png\"\u003e\u003c/p\u003e\n\n\u003c/br\u003e\n\n\u003ch2 align=\"center\"\u003e\u003cb\u003eDemo:\u003c/b\u003e\u003c/h2\u003e\n\n\u003cp align=\"center\"\u003eDownload the demo app  \u003ca href=\"https://github.com/HBiSoft/HBRecorder/releases/download/3.0.7/HBRecorderDemo.apk\"\u003e\u003cnobr\u003ehere\u003c/nobr\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"https://user-images.githubusercontent.com/35602540/66485516-3e78fd80-eaa9-11e9-9fea-f59bfa7c1389.gif\" width=\"247\" height=\"480\" \u003c/p\u003e\n\n\u003c/br\u003e\u003c/br\u003e\n    \n\n**Adding the library to your project:**\n---\nAdd the following in your root build.gradle at the end of repositories:\n\n```java\nallprojects {\n    repositories {\n        ...\n        maven { url 'https://jitpack.io' }\t    \n    }\n}\n```\n    \nImplement library in your app level build.gradle:\n\n```java\ndependencies {\n    implementation 'com.github.HBiSoft:HBRecorder:3.0.7'\n}\n```\n    \n\n**Implementing the library:**\n--- \n1. In your `Activity`, first implement `HBRecorder`, as shown below:\n\n```java\npublic class MainActivity extends AppCompatActivity implements HBRecorderListener {\n```\n\n2. `Alt+Enter` to implement the following methods:\n\n```java\n@Override\npublic void HBRecorderOnStart() {\n    //When the recording starts\n}\n\n@Override\npublic void HBRecorderOnComplete() {\n    //After file was created\n}\n@Override\npublic void HBRecorderOnError(int errorCode) {\n    //When an error occurs\n}\n\n@Override\npublic void HBRecorderOnPause() {\n    //When recording was paused\n}\n\n@Override\npublic void HBRecorderOnResume() {\n    //When recording was resumed\n}\n```\n    \n3. Init `HBRecorder` as shown below:\n```java\npublic class MainActivity extends AppCompatActivity implements HBRecorderListener {\n    HBRecorder hbRecorder;\n\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_main);     \n\n        //Init HBRecorder\n        hbRecorder = new HBRecorder(this, this);        \n\n}\n```\n    \n4. Add the following permissions in your manifest:\n```java\n\u003cuses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\" /\u003e\n\u003cuses-permission android:name=\"android.permission.WRITE_INTERNAL_STORAGE\" /\u003e\n\u003cuses-permission android:name=\"android.permission.RECORD_AUDIO\" /\u003e\n\u003cuses-permission android:name=\"android.permission.FOREGROUND_SERVICE\" /\u003e\n\u003c!-- For SDK 34 --\u003e\n\u003cuses-permission android:name=\"android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION\" /\u003e\n```\n\nThat's it, `HBRecorder` is now ready to be used.\n\n---\n\nWhen you want to start capturing your screen, it is important you do it as shown below:\n---\n```java\nprivate void startRecordingScreen() {\n    MediaProjectionManager mediaProjectionManager = (MediaProjectionManager) getSystemService(Context.MEDIA_PROJECTION_SERVICE);\n    Intent permissionIntent = mediaProjectionManager != null ? mediaProjectionManager.createScreenCaptureIntent() : null;\n    startActivityForResult(permissionIntent, SCREEN_RECORD_REQUEST_CODE);\n}\n\n@Override\nprotected void onActivityResult(int requestCode, int resultCode, Intent data) {\n    super.onActivityResult(requestCode, resultCode, data);\n    if (requestCode == SCREEN_RECORD_REQUEST_CODE) {\n        if (resultCode == RESULT_OK) {\n            //Start screen recording\n            hbRecorder.startScreenRecording(data, resultCode);\n\n        }\n    }\n}\n```\n\nAll available methods:\n---\n```java\n// Set the output path as a String\n// Only use this on devices running Android 9 and lower or you have to add android:requestLegacyExternalStorage=\"true\" in your manifest\n// Defaults to - Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES)\nhbrecorder.setOutputPath(String);\n// Set output Uri\n// Only use this on devices running Android 10\u003e\n// When setting a Uri ensure you pass the same name to HBRecorder as what you set in ContentValues (DISPLAY_NAME and TITLE)\nhbRecorder.setOutputUri(Uri);\n// Set file name as String\n// Defaults to - quality + time stamp. For example HD-2019-08-14-10-09-58.mp4\nhbrecorder.setFileName(String);\n// Set audio bitrate as int\n// Defaults to - 128000\nhbrecorder.setAudioBitrate(int);\n// Set audio sample rate as int \n// Defaults to - 44100\nhbrecorder.setAudioSamplingRate(int);\n// Enable/Disable audio\n// Defaults to true\nhbrecorder.isAudioEnabled(boolean);\n// Enable/Disable HD Video\n// Defaults to true\nhbrecorder.recordHDVideo(boolean);\n// Get file path as String\nhbrecorder.getFilePath();\n// Get file name as String\nhbrecorder.getFileName();\n// Start recording screen by passing it as Intent inside onActivityResult\nhbrecorder.startScreenRecording(Intent);\n// Pause screen recording (only available for devices running 24\u003e)\nhbrecorder.pauseScreenRecording();\n// Resume screen recording\nhbreccorder.resumeScreenRecording();\n// Stop screen recording\nhbrecorder.stopScreenRecording();\n// Check if recording is in progress\nhbrecorder.isBusyRecording();\n// Set notification icon by passing, for example R.drawable.myicon\n// Defaults to R.drawable.icon\nhbrecorder.setNotificationSmallIcon(int);\n// Set notification icon using byte array\nhbrecorder.setNotificationSmallIcon(byte[]);\n// Set notification icon using vector drawable\nhbRecorder.setNotificationSmallIconVector(vector);\n// Set notification title\n// Defaults to \"Recording your screen\"\nhbrecorder.setNotificationTitle(String);\n// Set notification description\n// Defaults to \"Drag down to stop the recording\"\nhbrecorder.setNotificationDescription(String);\n// Set notification stop button text\n// Defaults to \"STOP RECORDING\"\nhbrecorder.setNotificationButtonText(String);\n// Set output orientation (in degrees)\nhbrecorder.setOrientationHint(int);\n// Set max output file size\nhbrecorder.setMaxFileSize(long);\n// Set max time (in seconds)\nhbRecorder.setMaxDuration(int);\n```\n\nCustom setting:\n---\nWhen you want to enable custom settings you must first call:\n```java\nhbRecorder.enableCustomSettings();\n```\nThen you can set the following:\n```java\n//MUST BE ONE OF THE FOLLOWING - https://developer.android.com/reference/android/media/MediaRecorder.AudioSource.html\nhbRecorder.setAudioSource(String);\n//MUST BE ONE OF THE FOLLOWING - https://developer.android.com/reference/android/media/MediaRecorder.VideoEncoder.html\nhbRecorder.setVideoEncoder(String);\n//If nothing is provided, it will select the highest value supported by your device\nhbRecorder.setScreenDimensions(HeightInPx, WidthInPx);\n//Frame rate is device dependent\n//You can use Camcoderprofile to determine the frame rate\nhbRecorder.setVideoFrameRate(int);\n//The bitrate is also dependent on the device and the frame rate that is set\nhbRecorder.setVideoBitrate(int);\n//MUST BE ONE OF THE FOLLOWING - https://developer.android.com/reference/android/media/MediaRecorder.OutputFormat.html\nhbRecorder.setOutputFormat(String);\n```\n\n---\nIt is important to note that limitations are device dependent. It is best to set the video encoder to \"DEFAULT\" and let `MediaRecorder` pick the best encoder.\n\nIn the demo app you will have the option to test different video encoders, bitrate, frame rate and output formats. If your device does not support any of the parameters you have selected `HBRecorderOnError` will be called.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHBiSoft%2FHBRecorder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FHBiSoft%2FHBRecorder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHBiSoft%2FHBRecorder/lists"}