android-mediaprojection

How to use Mediaprojection library in android to capture screen and convert into mp4 file?

拈花ヽ惹草 提交于 2019-12-22 05:26:12
问题 Since android 5.0 they are providing mediaprojection library to capture screen content. but sample demo application provided by them is not clear. U can find sample app here. In that application they are projecting captured screen using virtualdisplay method private void setUpVirtualDisplay() { Log.i(TAG, "Setting up a VirtualDisplay: " + mSurfaceView.getWidth() + "x" + mSurfaceView.getHeight() + " (" + mScreenDensity + ")"); mVirtualDisplay = mMediaProjection.createVirtualDisplay(

Stream android screen

霸气de小男生 提交于 2019-12-21 07:11:05
问题 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

How to properly take a screenshot, globally?

∥☆過路亽.° 提交于 2019-12-18 12:17:31
问题 Background Since Android API 21, it's possible for apps to take screenshots globally and record the screen. The problem I've made a sample code out of all I've found on the Internet, but it has a few issues: It's quite slow. Maybe it's possible to avoid it, at least for multiple screenshots, by avoiding the notification of it being removed till really not needed. It has black margins on left and right, meaning something might be wrong with the calculations : What I've tried MainActivity.java

Android MediaProjectionManager in Service

◇◆丶佛笑我妖孽 提交于 2019-12-18 01:18:35
问题 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. 回答1: 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

Supported video sizes MediaRecorder API android

限于喜欢 提交于 2019-12-12 03:24:25
问题 I'm trying to record the contents of the screen using mediarecorder and mediaprojection api. When I'm trying to change the video to HD on my device the recording fails but it works fine with 640 x 480 resolution. So my question is how could I get the supported video resolutions on a particular device? Cheers Jon 回答1: If your only interest is in API 21+, you can use the getVideoCapabilities() method. The CamcorderProfile class has been around since API 8, but isn't quite as useful. If all else

Android virtual display release does not remove display

跟風遠走 提交于 2019-12-11 13:25:00
问题 I am using android Virtual Display along with Projection Manager At certain time, the projection need to be stopped, hence the following actions are taken @Override public void surfaceDestroyed(SurfaceHolder holder) { mMediaProjection.stop(); Log.e(TAG, "mMediaProjection.stopped "); mVirtualDisplay.release(); Log.e(TAG, "virtual display.released "); } The surfaceDestroyed is related to the surface which backs the Virtual Display. When it is the time to start Media Projection again, if

How can I use media projection for older api?

时间秒杀一切 提交于 2019-12-09 21:37:58
问题 I want to record the screen contents for 1 min. After searching google, I found that the api level 21 contains MediaProjecion class. My app is build for api level 18 . Can I use this class? Is there any support library for this? 回答1: Can I use this class? No. Is there any support library for this? No. 来源: https://stackoverflow.com/questions/31722833/how-can-i-use-media-projection-for-older-api

ScreenCapture via MediaProjection without user intervention in Kiosk apps - Android

爱⌒轻易说出口 提交于 2019-12-07 17:04:13
问题 I work for a digital signage company which has Android devices running in kiosk mode. Lately, we wanted to add screen capture for debugging. The easiest way to do that was to use getWindow().getDecorView().getRootView().getDrawingCache() to create bitmap and to send it over the network, but this will not capture videos as it's been rendered in surface view. MediaProjection's createVirtualDisplay seems promising, but the explicit permission needed to use this feature is not acceptable. Even

ScreenCapture via MediaProjection without user intervention in Kiosk apps - Android

北城余情 提交于 2019-12-06 03:26:53
I work for a digital signage company which has Android devices running in kiosk mode. Lately, we wanted to add screen capture for debugging. The easiest way to do that was to use getWindow().getDecorView().getRootView().getDrawingCache() to create bitmap and to send it over the network, but this will not capture videos as it's been rendered in surface view. MediaProjection's createVirtualDisplay seems promising, but the explicit permission needed to use this feature is not acceptable. Even requesting user permission for the first time and persisting the result for further use is not acceptable

How to use Mediaprojection library in android to capture screen and convert into mp4 file?

那年仲夏 提交于 2019-12-05 07:28:31
Since android 5.0 they are providing mediaprojection library to capture screen content. but sample demo application provided by them is not clear. U can find sample app here . In that application they are projecting captured screen using virtualdisplay method private void setUpVirtualDisplay() { Log.i(TAG, "Setting up a VirtualDisplay: " + mSurfaceView.getWidth() + "x" + mSurfaceView.getHeight() + " (" + mScreenDensity + ")"); mVirtualDisplay = mMediaProjection.createVirtualDisplay("ScreenCapture", mSurfaceView.getWidth(), mSurfaceView.getHeight(), mScreenDensity, DisplayManager.VIRTUAL