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
0
votes
0 answers

How to screen record secondary display using Media projection API?

I am building a screen recorder for dual screen android devices. Using this example i can successfully record primary screen. but can't find any to record secondary screen. I am using media projection API
0
votes
1 answer

Android 5.0 how to automatically obtain permissions when recording the screen?

MediaProjectionManager.createScreenCaptureIntent(); When sharing the screen, a window asking for permission will pop up. I am looking for a way to automatically obtain all content (permissions) on the screen. I have root access to this…
0
votes
1 answer

mediaprojection : Black screen in some cases

Using "mediaprojection" I was able to capture the current screen from a background service. The sdk api is 25, Android 7.1.2, and I checked it with an emulator running with BlueStacks without rooting and my mobile phone without rooting. But when I…
임철규
  • 37
  • 5
0
votes
0 answers

MediaProjection gives error while getting screenshot for android Api<25

I want to get screenshot of screen in android, I got screen shot as a Bitmap with using PixelCopy api for Api>=26 but I can not take screenshot for Api<25, When I try get screen shot of video I got black Screen, so I am trying to use MediaProjection…
Diego
  • 937
  • 8
  • 24
0
votes
1 answer

Android VirtualDisplay resize "on flight"

Recently in project I faced challenge of resizing VirtualDisplay "on flight". So the use case is : Start stream In undetermined period of stream there may come specific data which indicates that my streaming capabilities have changed Update…
0
votes
0 answers

MediaProjection - find a match in the screenshot

I am able to make a screenshot with MediaProjection in android Java what is the best way to find a image (lets say icon) in the screenshot, and get the coordinates of it , or click on it ?
0
votes
1 answer

MediaRecorder not recording the second time

I am using MediaRecorder to record the user screen. Everything is working fine when the app is opened for the first time and the user clicks the fab button to record the screen. But if the app is running, the user clicks the record button again, no…
0
votes
0 answers

I am getting error. (' android.app.ActivityThread.getApplicationThread()' on a null object reference )

I am trying to access a method of activity which calls the startActivityForResult method and it shows the error I have initialized this in the onCreate method of class enter code here mediaProjectionManager = (MediaProjectionManager)…
0
votes
0 answers

Activity gets destroy while ActivityCompat.requestPermissions

I downloaded the "usb-serial-for-android" sample application from this link. https://github.com/mik3y/usb-serial-for-android Home screen displays the usb device and while clicking on it the moving to second screen to read the data which usb…
0
votes
0 answers

How to disable ScreenShare on MediaProjection API but keep recording to save as MP4

I want to make a screen capture app with a notification tool bar on top like AZ Recorder or DU Recorder. From the examples i see online on how to use the new API MediaProjection they use ScreenShare enabled which prompts like you are projecting to…
0
votes
1 answer

How to share screen remotely in a video/audio call?

I am trying to build a video call app which has a feature of screen sharing. The users can share their screen during the call. I'm using WebRTC SDK to meet my purpose, but they have a solution for screen share when the call starts but not for screen…
0
votes
0 answers

Android MediaProjection captures blank spaces instead of video areas

When I try to capture screen on Android device using MediaProjection, in general, it's ok. But I see a blank space instead of video (I mean, in in the area which I wanted to capture included some adv videos on FaceBook or some movie on Netflix).…
0
votes
0 answers

Android Mediaprojection api from delphi

I have written something with delphi for testing android mediaprojection api. ( https://developer.android.com/reference/android/media/projection/MediaProjection ) I tried to convert some of the java codes to delphi. java example:…
0
votes
1 answer

Runtime exception on MediaRecorder.stop() function in android

I am creating a Screen Capturing App. Using MediaRecorder with MediaProjection API. Getting Run-time Exception while stopping the recorder Here is the code to stop Screen Capture private void stop_recorder() { if (virtualDisplay == null) { …
0
votes
1 answer

Use Floating Widget to take screenshot of any screen

I am trying to take a screenshot using Floating Widget. But I can't find any way of doing so. I searched for MediaProjection API but couldn't find anything helpful. Right now, If I tap the floating widget, it only captures the screenshot of the…
Waheed Abbas
  • 187
  • 1
  • 4
  • 18