glt / screenrecorder Goto Github PK
View Code? Open in Web Editor NEWAndroid 5.0+ 屏幕录制
Android 5.0+ 屏幕录制
Should update minSdkVersion to 21 in ScreenRecorder/recorder/build.gradle
...
minSdkVersion 9
...
startRecord()方法中,mediaRecorder.start();执行的时候报错,mediaRecorder打印是有值的。
同样小米的8.0系统,华为的8.0系统,小米可以录屏,华为的报错。
网上查了一下午,有类似的错误(地址:https://stackoverflow.com/questions/27524942/mediarecorder-start-throwing-illegalstateexception),但仍然解决不了。
我想将这个功能做到悬浮窗中,但是每次都会唤醒应用的activity,我猜想可能是startActivityForResult在activity中调用的缘故。但是service又无法调用startActivityForResult函数。不知道有没有方案可以在service中录屏,或者不唤醒activity?
mediaRecorder.setVideoSource(MediaRecorder.VideoSource.SURFACE);
报错:
setVideoSource failed
机型:华为HRY-AL00a 安卓10.0.0
Here will case ArrayIndexOutOfBoundsException
in MainActivity
if (grantResults[0] != PackageManager.PERMISSION_GRANTED) {
exception
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.glgjing.recorder, PID: 12158
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.glgjing.recorder/com.glgjing.recorder.MainActivity}: java.lang.ArrayIndexOutOfBoundsException: length=0; index=0
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2646)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Caused by: java.lang.ArrayIndexOutOfBoundsException: length=0; index=0
at com.glgjing.recorder.MainActivity.onRequestPermissionsResult(MainActivity.java:87)
at android.app.Activity.requestPermissions(Activity.java:4116)
at android.support.v4.app.ActivityCompatApi23.requestPermissions(ActivityCompat23.java:32)
at android.support.v4.app.ActivityCompat.requestPermissions(ActivityCompat.java:316)
at com.glgjing.recorder.MainActivity.onCreate(MainActivity.java:59)
at android.app.Activity.performCreate(Activity.java:6664)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
google pixel 3xl , android 10。 录制的视频屏幕不完整。
录屏代码太复杂了 有封装好的吗
直接弄3个函数
一个start录屏
一个stop录屏
一个获取录屏结果 可以保存成文件 可以变成流媒体传给服务器
求大佬看看 谢谢谢谢🙏🙏🙏🙏🙏
获取应用大小,我在网上看8.0一下通过aidl 反射就可以获取到。 8.0向上需要授权检测别的应用运行情况。老哥你是怎么做啊?我看你并不需要授权这个步骤
java.lang.RuntimeException: stop failed.
at android.media.MediaRecorder.stop(Native Method)
the saved mp4 can not play.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.