MediaRecorder and VideoSource.SURFACE, stop failed: -1007
anonym24 opened this issue · 2 comments
07-29 14:44:22.825 8076-8076/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.android.camera2video, PID: 8076
java.lang.RuntimeException: stop failed.
at android.media.MediaRecorder.stop(Native Method)
at com.example.android.camera2video.Camera2VideoFragment.stopRecordingVideo(Camera2VideoFragment.java:682)
at com.example.android.camera2video.Camera2VideoFragment.onClick(Camera2VideoFragment.java:312)
at android.view.View.performClick(View.java:5215)
at android.view.View$PerformClick.run(View.java:21193)
at android.os.Handler.handleCallback(Handler.java:742)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5571)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:745)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:635)
Tested devices:
WORKS OK ON:
- Lenovo P2 (Android 7)
- Xiaomi Mi A1 (Android 8)
DOESN'T WORK ON (stop fails with -1007, small video file and can't be played):
- Xiaomi Redmi 5 (Android 7)
- Sony Xperia (I don't remember the exact model and Android OS)
- Xiaomi Redmi 4 Prime (Android 6)
Also I reported this issue already
https://issuetracker.google.com/issues/111433520
Just deprecate next API
MediaRecorder.setVideoSource(MediaRecorder.VideoSource.SURFACE);
it's all buggy and usually works only Google Nexuses but Android works on many other devices
Just implement some other API which will work 100% for all devices
Yes we can use MediaCodec and OpenGL ES but it's very difficult
Just make some friendly API which will allow to record video, edit frames before recording (to add timestamp text for example) and background recording
This problem occurred when I clicked the record button frequently. The temporary solution is to reduce the frequent clicking, hoping to help you
This sample has been migrated to a new location (check README for more information).
As recommended by GitHub, we are closing all issues and pull requests now that this older repo will be archived.
If you still see this issue in the updated repo, please reopen the issue/PR there. Thank you!