Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to record screen on android #1508

Open
MinhMinh8722 opened this issue Jun 27, 2024 · 3 comments
Open

How to record screen on android #1508

MinhMinh8722 opened this issue Jun 27, 2024 · 3 comments

Comments

@MinhMinh8722
Copy link

Can you show me where the code for recording the screen and saving the file into local storage?
Thanks!!! 馃檹

@pedroSG94
Copy link
Owner

Hello,

If you want record the screen you can use this example:
https://github.com/pedroSG94/RootEncoder/tree/master/app/src/main/java/com/pedro/streamer/screen

If you want record instead of stream you can replace isStreaming to isRecording, startStream to startRecord and stopStream to stopRecord.

isStreaming:
https://github.com/pedroSG94/RootEncoder/blob/master/app/src/main/java/com/pedro/streamer/screen/ScreenService.kt#L112
To:

return genericStream.isRecording

startRecord:
https://github.com/pedroSG94/RootEncoder/blob/master/app/src/main/java/com/pedro/streamer/screen/ScreenService.kt#L155
To:

    if (!genericStream.isRecording) genericStream.startRecord(filePath)

And stop record:
https://github.com/pedroSG94/RootEncoder/blob/master/app/src/main/java/com/pedro/streamer/screen/ScreenService.kt#L119
To:

  fun stopStream() {
    if (genericStream.isRecording) {
      genericStream.stopRecord()
      notificationManager?.cancel(notifyId)
    }
  }

In ScreenActivity you will need replace the stream url provided in the startRecord to a valid file path

@MinhMinh8722
Copy link
Author

Thanks for your answer. And can I draw a watermark on surfaceview?

@pedroSG94
Copy link
Owner

You can use filters:
https://github.com/pedroSG94/RootEncoder/blob/master/app/src/main/java/com/pedro/streamer/utils/FilterMenu.kt#L211
You can get glInterface with:

genericStream.getGlInterface()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants