首页 > 一个关于MediaRecorder.setMaxDuration()的问题

一个关于MediaRecorder.setMaxDuration()的问题

void android.media.MediaRecorder.setMaxDuration(int max_duration_ms) throws IllegalArgumentException

Sets the maximum duration (in ms) of the recording session. Call this after setOutFormat() but before prepare(). After recording reaches the specified duration, a notification will be sent to the android.media.MediaRecorder.OnInfoListener with a "what" code of MEDIA_RECORDER_INFO_MAX_DURATION_REACHED and recording will be stopped. Stopping happens asynchronously, there is no guarantee that the recorder will have stopped by the time the listener is notified.
google这里解释的最后一句话的意思大概是当监听被通知的时候不能保证recorder已经完成了,不理解,既然这个监听是不准的, 那我要这个还有卵用? 我要实现的功能很简单,就是类似微信的一样Camera拍摄15s的视频之后停止,我要监听Camera什么时候真正完成录制视频了。

【热门文章】
【热门文章】