ScreenCapture
ScreenCapture copied to clipboard
Use MediaProjection to get Screen Capture.
当targetSdkVersion >= 29 时, 会崩溃报错.require a foreground service of type ServiceInfo.FOREGROUND_SERVICE
删除没有必要的静态方法构造器
由于循环录屏中,调用cleanup退出,mMediacodec释放资源,但本轮循未执行完成,对象状态异常导致的bug 2021-10-12 11:38:53 717 d com.yys.monitor.ScreenCapture ,record, release() 2021-10-12 11:38:53 724 e com.yys.utils.CrashHandler =========java.lang.IllegalStateException at android.media.MediaCodec.native_dequeueOutputBuffer(Native Method) at android.media.MediaCodec.dequeueOutputBuffer(MediaCodec.java:2698) at com.yys.monitor.ScreenCapture.recordVirtualDisplay(ScreenCapture.java:385) at com.yys.monitor.ScreenCapture.lambda$startRecord$0(ScreenCapture.java:360) at com.yys.monitor.-$$Lambda$ScreenCapture$dgqDW8lr2mITEYv3l84i7RtgBOI.run(Unknown Source:2) at java.lang.Thread.run(Thread.java:764)
将录制中的finnally中的 release()放入catch中;//异常则释放资源,调用cleanup ,finally退出释放资源 2次的错误
在fragment中使用时,通过跟踪,只显示了请求的弹窗,没有真正的截图结果。 ``java mScreenCapture = ScreenCapture.newInstance((AppCompatActivity) getActivity()); ```
请问录屏支持view 区域录屏吗?只录屏幕的一部分