android-mediaprojection

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

喜夏-厌秋 提交于 2021-01-29 14:19:40
问题 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 share while the call is ongoing. One can tick the screen sharing option and can start the call but cannot start screen sharing during the call. I added a button on the CallActivity screen which on click calls MediaProjection Class of Android to

Android VirtualDisplay.release() not releasing the display

二次信任 提交于 2021-01-28 04:11:01
问题 I'm using android MediaProjection for taking screenshot. The projection needs to be stopped after taking screenshot and virtual display should be released but VirtualDisplay.release() is not releasing the display. Here is the code to create display. startActivityForResult(mProjectionManager.createScreenCaptureIntent(), REQUEST_CODE); @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_CODE) { sMediaProjection =

How to take a Screenshot from a background-service class using MediaProjection API?

巧了我就是萌 提交于 2020-12-15 06:17:30
问题 After doing a lot of research on this topic, though I found a few answers, I could not understand how the MediaProjection API works. I want to take a screenshot of the device from a background Service class. Is it possible to do it. I have one MainActivity.java which starts a serviceIntent to another class which is a service(not an activity). So I want to implement this API in this service class. Please help me 回答1: This is tricky way to achieve this. First of all you need to create

How to take a Screenshot from a background-service class using MediaProjection API?

有些话、适合烂在心里 提交于 2020-12-15 06:16:11
问题 After doing a lot of research on this topic, though I found a few answers, I could not understand how the MediaProjection API works. I want to take a screenshot of the device from a background Service class. Is it possible to do it. I have one MainActivity.java which starts a serviceIntent to another class which is a service(not an activity). So I want to implement this API in this service class. Please help me 回答1: This is tricky way to achieve this. First of all you need to create

Media projections require a foreground service of type ServiceInfo.FOREGROUND_SERVICE TYPE_MEDIA_PROJECTION in Android Pie and Q

こ雲淡風輕ζ 提交于 2020-11-28 08:30:04
问题 any body knows why this error occur, Media projections require a foreground service of type ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION on getMediaProjection() even i call getMediaProjection() method after calling startforeground() method..! Stack Trace is : Process: com.al1.screenrecorder, PID: 24641 java.lang.RuntimeException: Unable to start service com.al1.screenrecorder.service.DisplayRecorderService@9ef2101 with Intent { cmp=com.al1.screenrecorder/.service

Media projections require a foreground service of type ServiceInfo.FOREGROUND_SERVICE TYPE_MEDIA_PROJECTION in Android Pie and Q

社会主义新天地 提交于 2020-11-28 08:29:04
问题 any body knows why this error occur, Media projections require a foreground service of type ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION on getMediaProjection() even i call getMediaProjection() method after calling startforeground() method..! Stack Trace is : Process: com.al1.screenrecorder, PID: 24641 java.lang.RuntimeException: Unable to start service com.al1.screenrecorder.service.DisplayRecorderService@9ef2101 with Intent { cmp=com.al1.screenrecorder/.service

MediaProjection service type not recognized in android Q

梦想的初衷 提交于 2020-08-22 12:18:30
问题 With the new privacy changes in effect with Android Q, it is now mandatory for any app using MediaProjection api to specify android:foregroundServiceType attribute in the service tag under manifest. But recently, I noticed that though I set the android:foregroundServiceType="mediaprojection" there is a security exception thrown. Does anybody have any idea what I'm doing wrong? Manifest: <service android:name=".services.MediaProjectionService" android:enabled="true" android:exported="false"

Android record screen but only specific 'layers'/views

我的未来我决定 提交于 2020-01-01 17:00:29
问题 I use the MediaProjection API to record a screen in Android. Now I want to know whether it's possible to create a let's say "hidden" view which you actually can see but not in the video thus the view shouldn't be recorded. Furthermore is it possible to disable the recording of notifications or even the notification-center? So is it possible to configure like a 'surface-layer-system', thus you can decide which layer you want to record? 回答1: Preventing a layer from appearing in recordings can

Android ImageReader get NV21 format?

笑着哭i 提交于 2020-01-01 04:57:19
问题 I do not have a background in imaging or graphics, so please bear with me :) I am using JavaCV in one of my projects. In the examples, a Frame is constructed which has a buffer of a certain size. When using the public void onPreviewFrame(byte[] data, Camera camera) function in Android, copying this data byte array is no problem if you declare the Frame as new Frame(frameWidth, frameHeight, Frame.DEPTH_UBYTE, 2); where frameWidth and frameHeight are declared as Camera.Size previewSize =

How to trim video with MediaCodec

…衆ロ難τιáo~ 提交于 2019-12-30 05:28:27
问题 I'm trying to record the screen with MediaProjection API. I want to trim the video that was recorded by the media projection. Is there a way to do that without using any 3rd party dependency? 回答1: After lots of digging, I found this snippet /** * @param srcPath the path of source video file. * @param dstPath the path of destination video file. * @param startMs starting time in milliseconds for trimming. Set to * negative if starting from beginning. * @param endMs end time for trimming in