bmcreations / scrcast

Drop-in Android Screen Recording Library
https://bmcreations.github.io/scrcast/
Apache License 2.0
212 stars 26 forks source link

Question: is it a good solution to capture only the current app's content? #50

Closed AndroidDeveloperLB closed 3 years ago

AndroidDeveloperLB commented 3 years ago

Suppose I want to capture only what's on my app, is this still the only solution that I can use, using the special permission? Or is there a better one?

And what if I want to capture what's on my app, but including when it shows the OS background (static or live wallpaper) behind ?

bmc08gt commented 3 years ago

This library will allow you to integrate full device screen recording into an existing or new app. That includes all app content and system level screens.

bmc08gt commented 3 years ago

This library will allow you to integrate full device screen recording into an existing or new app. That includes all app content and system level screens.

With that being said, there is an option to end screen recording on screen off https://bmcreations.github.io/scrcast/api/library/dev.bmcreations.scrcast.config/-options/stop-on-screen-off/.

I can add an option to pause/resume wrt app lifecycle

AndroidDeveloperLB commented 3 years ago

Oh so it's global and not just of the app... Right?

bmc08gt commented 3 years ago

Oh so it's global and not just of the app... Right?

Correct. It utilizes platform APIs to record the entire screen content.

AndroidDeveloperLB commented 3 years ago

@bmc08gt I see. Do you know perhaps if it's possible to capture just the current app, without this special permission ?

bmc08gt commented 3 years ago

@bmc08gt I see.

Do you know perhaps if it's possible to capture just the current app, without this special permission ?

Which permission are you referring to?

AndroidDeveloperLB commented 3 years ago

@bmc08gt I don't know how it's called, but it's what you get when you start recording. It asks you if it's ok to let the app record the screen.

bmc08gt commented 3 years ago

@bmc08gt I don't know how it's called, but it's what you get when you start recording. It asks you if it's ok to let the app record the screen.

Unfortunately there is no way around that request. It's tied to the MediaProjection APIs.

AndroidDeveloperLB commented 3 years ago

@bmc08gt So without MediaProjection , I can't take a video of my own app? What about images? This is possible?

bmc08gt commented 3 years ago

@bmc08gt So without MediaProjection , I can't take a video of my own app?

What about images? This is possible?

Screenshots are possible without media projection. Window provides the drawing cache or you can utilize canvas to save the result into a bitmap.

AndroidDeveloperLB commented 3 years ago

@bmc08gt This won't work though if you have an Activity that shows the current wallpaper though, right? BTW, I think there is a better solution nowadays instead of drawing cache.

bmc08gt commented 3 years ago

@bmc08gt This won't work though if you have an Activity that shows the current wallpaper though, right?

BTW, I think there is a better solution nowadays instead of drawing cache.

Those were two examples but yes there is.

AndroidDeveloperLB commented 3 years ago

@bmc08gt Two examples?