![](https://private-user-images.githubusercontent.com/45873564/299685183-8f068289-de82-4486-b236-e167c5bb0266.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQyMzQ2MDMsIm5iZiI6MTcyNDIzNDMwMywicGF0aCI6Ii80NTg3MzU2NC8yOTk2ODUxODMtOGYwNjgyODktZGU4Mi00NDg2LWIyMzYtZTE2N2M1YmIwMjY2LmpwZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODIxVDA5NTgyM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTE3MzFkMTE1NDk2YzEzYmZlNWI1M2EwZmExZDBkYzQ2MmEwNzA1YjM1Y2QwYmExZGJhOTZkYTNjOWRlYWI1MjcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.0D3AaZFxcE9ODXAJFW1gTfiW9FmZAOuX2l7M1SjgBNY)
![](https://private-user-images.githubusercontent.com/45873564/299685205-2fc0283b-e519-4a3e-950a-f60028004396.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQyMzQ2MDMsIm5iZiI6MTcyNDIzNDMwMywicGF0aCI6Ii80NTg3MzU2NC8yOTk2ODUyMDUtMmZjMDI4M2ItZTUxOS00YTNlLTk1MGEtZjYwMDI4MDA0Mzk2LmpwZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODIxVDA5NTgyM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTE3MDJjYWNlNjlhMDk5MTRjMDgwOTM4MGRhZTA1NmYwNjU3MzkyMWU2YTQxMzhlYWMxMmNmNTQ0YjQyYWVmMDEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.IbJCVx90XiSM9udpgxiTjib7n89tzJjrTHygit4rz7U)
This module provides a screen recording solution for Android using H.264 encoding and MediaProjection. It allows you to easily capture the device's screen and encode it into H.264 video format. Your support is greatly appreciated, so please consider giving us a ⭐star⭐ if you find this module useful!
To use the Screen Recording Module, follow these steps:
-
Add the module as a dependency in your Android project.
-
Use the
H264EncoderCapture
interface to start and stop screen recording.
-
startCapture(filePath: String, code: Int, data: Intent, context: Context)
: Initiates the screen recording process with the provided parameters.filePath
: A string representing the file path where the recorded video will be saved.code
: An integer obtained from the MediaProjection indicating the permission to capture the screen.data
: AnIntent
obtained from the MediaProjection with additional screen capture data.context
: The Android application context.
-
stopCapture()
: Stops the ongoing screen recording session, finalizing the recorded video.
This interface simplifies the process of integrating screen recording capabilities into your Android app using H.264 encoding and MediaProjection. It allows you to initiate and terminate screen recording with ease, making it a valuable tool for various applications.
You have the freedom to customize and tailor the screen recording module to your specific requirements. Feel free to modify the recording settings, file paths, or any other aspects of the module to best fit your application.
Here's an example of how to use the H264EncoderCapture
interface to start screen recording:
// Start screen recording
val filePath = "your_file_path_here.mp4"
val code = // Obtain code from MediaProjection
val data = // Obtain ScreenCaptureIntent from MediaProjection
H264EncoderCapture.startCapture(filePath, code, data, context)
// Stop screen recording
H264EncoderCapture.stopCapture()
Please refer to the detailed usage code in the project :)