Questions tagged [android-mediaprojection]

MediaProjection is an Android class that facilitates capturing the screen and recording system audio.

The android.media.projection classes were introduced in Android API 21 to allow applications to record still images, video, and (potentially) audio from the device. In previous releases, applications were only allowed to capture their own rendering, and different approaches were required for View-based UI and OpenGL ES rendering.

Because capturing content outside of the current application has security implications, applications wishing to use these features must get permission from the user first. This is handled through the MediaProjectionManager.

An official screen capture example can be found on github.

The images captured by the MediaProjection are sent to a virtual display, which takes a Surface as an argument. The Surface can be provided by a SurfaceView (for immediate display), an ImageReader (for access from software), constructed from a SurfaceTexture (for use as an OpenGL ES texture), or by MediaCodec/MediaRecorder (for video encoding).

178 questions
1
vote
2 answers

API Level 29 - MediaProjection is always requesting permission

until Android API28 when requesting Media Projection Services android allowed the user to grant access just once by selecting "Don't show again" check-box. So that everytime app wants to use media projection services the access was already…
Carlos
  • 433
  • 5
  • 19
1
vote
0 answers

Android java crash screen recording

I have the following code that allows you to record what happens on the screen. It works, but there are some problems and unforeseen events that happen and I do not understand which set of situations allow that app to crash. To make one of the…
1
vote
0 answers

MediaProjection Service Issues in Android

When user install Application in mobile, he/she needs to give MediaProjection system service permission to start screen shot feature. Whenever user restart mobile, user needs to give MediaProjection service permission manually every time. I want to…
PPG
  • 23
  • 6
1
vote
2 answers

Can't find screen recorded video (/sdcard/capture.mp4") - Mediaprojection API

I'm still a biginner on android APP development and I'm trying to use Mediaprojection API to record my screen .. the issue that I am facing now is.. After recording I cant find the video file in the defined location (sdcard/capture.mp4) .. below is…
1
vote
1 answer

Record a layout with Android Api

I have successfully record a screen with MediaProjection api, but I want to record a specific layout/view in my activity not whole screen. I followed these…
abalta
  • 1,204
  • 1
  • 12
  • 21
1
vote
0 answers

Unable To start mediaprojection twise

hey there i have a complete running app witch starts capturing screen contents from a foreground service however it's crash when i attempt to record for second time after stopping here's the the whole scenario: i'm starting a foreground service from…
1
vote
0 answers

How to use MediaProjection to save data in a Picture?

I'm trying to use MediaProjection API https://developer.android.com/reference/android/media/projection/MediaProjection.html To Save Data To a series of pictures. All that i could find on the web was guides that use a Surface, and they cast the…
Chief Madog
  • 1,738
  • 4
  • 28
  • 55
1
vote
0 answers

Android Media Projection memory leak?

I'm working on a project that's using Android Media Projection. I'm seeing a rather large memory leak in native code (the app jvm memory usage is fairly low and stable). I've been able get native memory dumps, and I see a bunch of 4Mb buffers that…
1
vote
1 answer

Screen video recording with sound in Android

Currently I am developing an app which records video of mobile screens (screen recording) as per user interactions. Now I want to record video with audio or sound. How can I achieve this feature? for video recording I am using following code: …
Nik
  • 1,991
  • 2
  • 13
  • 30
1
vote
0 answers

Capture only a part of the screen with MediaProjection

I need to record only specific view and child views inside that view but to exclude other views on the Activity/Screen. Currently I'm working on one project and a thought that I can solve the problem with MediaProjection API. As I said, I need to…
slena17
  • 33
  • 1
  • 12
1
vote
0 answers

Why created Playlist is not visible on android?

I didnot get any answer, so I decided to re-edit I am using this class to create music playlist in android. I got the code from here Code: public static final String TAG = "MediaUtil"; public static void deleteTrack(Context context, String…
1
vote
1 answer

Image.getPlanes() on Android is too heavy

Folks, I'm developing screen capture application on Android that using MediaProjection API. I'm using ImageReader to realize it but Image.getPlanes() is too heavy to capture realtime screen. It lost too much frames to see smooth rendered screen…
1
vote
1 answer

Screen record in application with SDK under 21

I'm trying to make my app have a feature: record itself and write to external store and import to Youtube. I used MediaProjection with API 21+, it's done. But if i want to record in lower devices (i mean device with SDK 20 or lower), how is…
1
vote
1 answer

Prevent MediaProjection object from being lost on killing the Application

I am using MediaProjection to take screenshot.This is what I am doing.I created an overlay icon using service.On clicking the overlay icon a screenshot is taken.The problem is that whenever the Application is killed either by pressing back button or…
Junior
  • 113
  • 1
  • 7
1
vote
0 answers

Blank MP4 Video From Android Screen Capture in Emulator

I have been trying to capture the screen from Android Emulator and record it to a .mp4 file. I adopted the standard approach of creating a virtual display and routing the frames to an encoder, multiplexing the video channel and writing to the an…