From 1a7b506de3297cc12a1088a6ceed3dc54d89eaae Mon Sep 17 00:00:00 2001 From: HBiSoft <35602540+HBiSoft@users.noreply.github.com> Date: Wed, 14 Aug 2019 10:35:17 +0200 Subject: [PATCH 1/4] Create ReadMe --- README.md | 141 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..910d449 --- /dev/null +++ b/README.md @@ -0,0 +1,141 @@ +# HBRecorder +Lightweight screen and audio capturing Android library + +![hbicon](https://user-images.githubusercontent.com/35602540/63006287-7df6e500-be7e-11e9-82b6-40814d8201df.png) + + +**Requires API level 21>** + + +**Adding the library to your project:** +--- +Add the following in your root build.gradle at the end of repositories: + + allprojects { + repositories { + ... + maven { url 'https://jitpack.io' } + } + } + +Implement library in your app level build.gradle: + + dependencies { + implementation 'com.github.HBiSoft:HBRecorder:Tag' + } + + +**Implementing the library:** +--- +1. In your `Activity`, first implement `HBRecorder`, as shown below: + + public class MainActivity extends AppCompatActivity implements HBRecorderListener { + +2. `Alt+Enter` to implement the following method: + + @Override + public void HBRecorderOnComplete() { + //This is called once the file was created + } + +3. Init `HBRecorder` as shown below: + + public class MainActivity extends AppCompatActivity implements HBRecorderListener { + HBRecorder hbRecorder; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + //Init HBRecorder + hbRecorder = new HBRecorder(this, this); + + } + +4. Add the following permissions in your manifest: + + + + + + +
+That's it `HBRecorder` is now ready to be used. + + +When ever you want to start capturing your screen, it is important you do it as shown below: +--- + private void startRecordingScreen() { + MediaProjectionManager mediaProjectionManager = (MediaProjectionManager) getSystemService(Context.MEDIA_PROJECTION_SERVICE); + Intent permissionIntent = mediaProjectionManager != null ? mediaProjectionManager.createScreenCaptureIntent() : null; + startActivityForResult(permissionIntent, SCREEN_RECORD_REQUEST_CODE); + } + + @Override + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + super.onActivityResult(requestCode, resultCode, data); + if (requestCode == SCREEN_RECORD_REQUEST_CODE) { + if (resultCode == RESULT_OK) { + //It is important to call this before starting the recording + hbRecorder.onActivityResult(resultCode, data, this); + //Start screen recording + hbRecorder.startScreenRecording(data); + + } + } + } + + + +All available methods: +--- + // Set the output path as a String + // Defaults to - Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES) + hbrecorder.setOutputPath(String); + // Set file name as String + // Defaults to - quality + time stamp. For example HD-2019-08-14-10-09-58.mp4 + hbrecorder.setFileName(String); + // Set audio bitrate as int + // Defaults to - 128000 + hbrecorder.setAudioBitrate(int); + // Set audio sample rate as int + // Defaults to - 44100 + hbrecorder.setAudioSamplingRate(int); + // Enable/Disable audio + // Defaults to true + hbrecorder.isAudioEnabled(boolean); + // Enable/Disable HD Video + // Defaults to true + hbrecorder.recordHDVideo(boolean); + // Get file path as String + hbrecorder.getFilePath(); + // Get file name as String + hbrecorder.getFileName(); + // Start recording screen by passing it as Intent inside onActivityResult + hbrecorder.startScreenRecording(Intent); + // Stop screen recording + hbrecorder.stopScreenRecording(); + // Check if recording is in progress + hbrecorder.isBusyRecording(); + // Enable/Disable notification while recording by passing a boolean + // Defaults to false + hbrecorder.shouldShowNotification(boolean); + // Set notification icon by passing, for example R.drawable.myicon + // Defaults to R.drawable.icon + hbrecorder.setNotificationSmallIcon(int); + // Set notification title + // Defaults to "Recording your screen" + hbrecorder.setNotificationTitle(String); + // Set notification description + // Defaults to "Drag down to stop the recording" + hbrecorder.setNotificationDescription(String); + //Set notification stop button text + // Defaults to "STOP RECORDING" + hbrecorder.setNotificationButtonText(String); + + + + + + From bed4f0c3f23636290baa7e18c7b9c1544e7f1d75 Mon Sep 17 00:00:00 2001 From: HBiSoft <35602540+HBiSoft@users.noreply.github.com> Date: Wed, 14 Aug 2019 10:37:22 +0200 Subject: [PATCH 2/4] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 910d449..68b802f 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Add the following in your root build.gradle at the end of repositories: Implement library in your app level build.gradle: dependencies { - implementation 'com.github.HBiSoft:HBRecorder:Tag' + implementation 'com.github.HBiSoft:HBRecorder:0.1.0' } From 3b8780b0eead7db9af597d9a7a9e396abb77da0b Mon Sep 17 00:00:00 2001 From: HBiSoft <35602540+HBiSoft@users.noreply.github.com> Date: Wed, 14 Aug 2019 11:31:11 +0200 Subject: [PATCH 3/4] Update README.md --- README.md | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 68b802f..b31bd94 100644 --- a/README.md +++ b/README.md @@ -12,10 +12,10 @@ Lightweight screen and audio capturing Android library Add the following in your root build.gradle at the end of repositories: allprojects { - repositories { - ... - maven { url 'https://jitpack.io' } - } + repositories { + ... + maven { url 'https://jitpack.io' } + } } Implement library in your app level build.gradle: @@ -29,37 +29,37 @@ Implement library in your app level build.gradle: --- 1. In your `Activity`, first implement `HBRecorder`, as shown below: - public class MainActivity extends AppCompatActivity implements HBRecorderListener { + public class MainActivity extends AppCompatActivity implements HBRecorderListener { 2. `Alt+Enter` to implement the following method: - @Override - public void HBRecorderOnComplete() { - //This is called once the file was created - } + @Override + public void HBRecorderOnComplete() { + //This is called once the file was created + } 3. Init `HBRecorder` as shown below: - public class MainActivity extends AppCompatActivity implements HBRecorderListener { - HBRecorder hbRecorder; + public class MainActivity extends AppCompatActivity implements HBRecorderListener { + HBRecorder hbRecorder; - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_main); + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); - //Init HBRecorder - hbRecorder = new HBRecorder(this, this); + //Init HBRecorder + hbRecorder = new HBRecorder(this, this); - } + } 4. Add the following permissions in your manifest: - - - - - + + + + +
That's it `HBRecorder` is now ready to be used. From a677a4f846e81826977e0af9ddef042c25f4c490 Mon Sep 17 00:00:00 2001 From: HBiSoft <35602540+HBiSoft@users.noreply.github.com> Date: Wed, 14 Aug 2019 11:35:09 +0200 Subject: [PATCH 4/4] Update README.md --- README.md | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index b31bd94..86a8485 100644 --- a/README.md +++ b/README.md @@ -13,53 +13,53 @@ Add the following in your root build.gradle at the end of repositories: allprojects { repositories { - ... - maven { url 'https://jitpack.io' } - } + ... + maven { url 'https://jitpack.io' } + } } Implement library in your app level build.gradle: dependencies { - implementation 'com.github.HBiSoft:HBRecorder:0.1.0' - } + implementation 'com.github.HBiSoft:HBRecorder:0.1.0' + } **Implementing the library:** --- 1. In your `Activity`, first implement `HBRecorder`, as shown below: - public class MainActivity extends AppCompatActivity implements HBRecorderListener { + public class MainActivity extends AppCompatActivity implements HBRecorderListener { 2. `Alt+Enter` to implement the following method: - @Override - public void HBRecorderOnComplete() { - //This is called once the file was created - } + @Override + public void HBRecorderOnComplete() { + //This is called once the file was created + } 3. Init `HBRecorder` as shown below: - public class MainActivity extends AppCompatActivity implements HBRecorderListener { - HBRecorder hbRecorder; + public class MainActivity extends AppCompatActivity implements HBRecorderListener { + HBRecorder hbRecorder; - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_main); + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); - //Init HBRecorder - hbRecorder = new HBRecorder(this, this); + //Init HBRecorder + hbRecorder = new HBRecorder(this, this); - } + } 4. Add the following permissions in your manifest: - - - - - + + + + +
That's it `HBRecorder` is now ready to be used.