MediaRecorder.stop() hanging with Android 4.0 (ICS)

后端 未结 9 1290
夕颜
夕颜 2021-02-04 01:08

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\

9条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-04 01:50

    I'd recommand that you do it in a background thread, so that your app doesn't get stuck, even if the stop() method blocks:

        new Thread("STOP_RECORDER") {
            public void run() {
                Log.d(TAG, "Stopping recorder...");
                mediaRecorder.stop();
                Log.d(TAG, "Recorder successfully stopped");
            }
        }.start();
    

提交回复
热议问题