How to know when MediaRecorder has finished writing data to file

前端 未结 6 962
迷失自我
迷失自我 2021-02-05 08:01

We\'re using MediaRecorder to record video to a file on the external storage using setOutputFile() before doing the actual recording.

Everything works fine, but the main

6条回答
  •  深忆病人
    2021-02-05 08:18

    In my tests irrespective of the size of the recording mediaRecorder.stop() is a blocking method that only returns after the file has been completely written and closed by the media recorder.

    So JPMs answer is actually correct.

    You can verify this by calling File.length() immediately after stop(). You will find that the output file length is the final length of the file at this point. In other words media recorder does not write anything further to the file after stop() has returned.

提交回复
热议问题