本文介绍了MediaRecorder.stop()随Android 4.0(ICS)一起挂起的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的视频捕获活动中调用stop()时,软件有时会挂起,并且不会恢复正常.只有点击返回"来触发ANR,我才能终止该活动.

When calling stop() within my Video Capture activity, on occasion, the software will hang and will not come back to life. Only triggering an ANR by hitting "Back" will allow me to kill the activity.

在日志中,我看到以下行一遍又一遍地重复:

Within the log, I see the following line repeated over and over:

还有其他人看到过这种行为吗?有任何解决方法吗?

Has anyone else seen this behavior? Any workarounds?

推荐答案

这也发生在我身上,因为我在记录器上执行stop()之前释放了相机.它还说明了错误消息等待传入的摄像机视频帧超时".它正在等待已经发布的相机.确保停止录像机-然后才释放相机:

This also happened to me because I was releasing the camera before performing stop() on the recorder. It also explains the error message "Timed out waiting for incoming camera video frames". It's waiting for a camera that is already released.Make sure to stop the recorder - and only then release the camera:

mMediaRecorder.stop();
mMediaRecorder.release();

camera.stopPreview();
camera.release();

这篇关于MediaRecorder.stop()随Android 4.0(ICS)一起挂起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 16:57