android-mediaprojection

Android record screen but only specific 'layers'/views

老子叫甜甜 提交于 2019-12-04 13:09:49
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? Preventing a layer from appearing in recordings can be done by setting the "secure" flag . See for example the "multi-surface test" in Grafika , which sets the

Stream android screen

ε祈祈猫儿з 提交于 2019-12-03 23:35:34
I am trying to fallow Truiton ScreenCapture example, in order to record the device screen using MediaProjection When saving the recording localy it works mMediaRecorder.setVideoSource(MediaRecorder.VideoSource.SURFACE); mMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4); String localFilePath = getLocalFilePath(); mMediaRecorder.setOutputFile(localFilePath); mMediaRecorder.setVideoSize(DISPLAY_WIDTH, DISPLAY_HEIGHT); mMediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.MPEG_4_SP); mMediaRecorder.setVideoFrameRate(30); mMediaRecorder.prepare(); How ever when changing to work

Android ImageReader get NV21 format?

回眸只為那壹抹淺笑 提交于 2019-12-03 12:56:15
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 = cameraParam.getPreviewSize(); int frameWidth = previewSize.width; int frameHeight = previewSize.height;

How to trim video with MediaCodec

萝らか妹 提交于 2019-11-30 16:33:00
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? mnagy 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 milliseconds. Set to negative if * no trimming at the end. * @param useAudio true if keep the audio track

Black edges around the taken screenshot

邮差的信 提交于 2019-11-29 07:58:17
I'm following this example : package com.mtsahakis.mediaprojectiondemo; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.Bitmap.CompressFormat; import android.graphics.PixelFormat; import android.graphics.Point; import android.hardware.display.DisplayManager; import android.hardware.display.VirtualDisplay; import android.media.Image; import android.media.ImageReader; import android.media.projection.MediaProjection; import android.media.projection.MediaProjectionManager; import android.os.Bundle;

Android MediaProjectionManager in Service

孤者浪人 提交于 2019-11-28 21:56:53
I want to build an app where I have to use MediaProjectionManager in a Service. But I can not solve it as 'startActivityForResult' can't use in Service class. I really want to do this from a service, which is how I found this question. This is the closest I've came up, so just throwing this out there, till a better answer comes along. Here's a way to do it from an activity that's almost like doing it from a service: import static your.package.YourClass.mediaProjectionManager; public class MainActivity extends Activity { @Override protected void onCreate(final Bundle savedInstanceState) { super

Bitmap from ImageReader always blank when trying to capture screen

我是研究僧i 提交于 2019-11-28 10:26:28
问题 Using the MediaProjection API for screen capture, I create an ImageReader and feed use it as a point of access for captured screens as below: mImageReader = ImageReader.newInstance(mWidth, mHeight, ImageFormat.JPEG, 2); and mImageReader.setOnImageAvailableListener(new ImageReader.OnImageAvailableListener() { @Override public void onImageAvailable(ImageReader reader) { Image image = null; Bitmap bitmap = null; image = mImageReader.acquireLatestImage(); Image.Plane[] planes = image.getPlanes();

Resize Surface When Resizing VirtualDisplay

强颜欢笑 提交于 2019-11-28 09:42:22
问题 A while ago I askedthis question which received an answer. I have implemented an intermediary Surface as the answer suggested, but now I've run into another problem. At some points in time during my application, my VirtualDisplay can change resolution. So, I'd like to also update the size of my intermediary Surface to match the change in resolution of the VirtualDisplay . I was hoping this would be a simple call to setDefaultBufferSize on the Surface's underlying SurfaceTexture , but that

Black edges around the taken screenshot

限于喜欢 提交于 2019-11-28 01:29:32
问题 I'm following this example : package com.mtsahakis.mediaprojectiondemo; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.Bitmap.CompressFormat; import android.graphics.PixelFormat; import android.graphics.Point; import android.hardware.display.DisplayManager; import android.hardware.display.VirtualDisplay; import android.media.Image; import android.media.ImageReader; import android.media