Skip to content

Commit

Permalink
1.添加录制停止时间记录
Browse files Browse the repository at this point in the history
2.去掉必须录制音频的限制,使得可录制无声视频
  • Loading branch information
szitguy committed Oct 29, 2015
1 parent 367214f commit a011f01
Showing 1 changed file with 24 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,17 @@ public class WXLikeVideoRecorder implements Camera.PreviewCallback, CameraPrevie
volatile boolean runAudioThread = true;

private volatile FFmpegFrameRecorder recorder;

/**
* 录制开始时间
*/
private long startTime;

/**
* 录制停止时间
*/
private long stopTime;

private boolean recording;

/* The number of seconds in the continuous record loop (or 0 to disable loop). */
Expand Down Expand Up @@ -114,6 +124,14 @@ public long getStartTime() {
return startTime;
}

/**
* 获取停止时间
* @return
*/
public long getStopTime() {
return stopTime;
}

//---------------------------------------
// initialize ffmpeg_recorder
//---------------------------------------
Expand Down Expand Up @@ -246,6 +264,8 @@ public void stopRecording() {
if (!recording)
return;

stopTime = System.currentTimeMillis();

runAudioThread = false;
try {
audioThread.join();
Expand Down Expand Up @@ -317,10 +337,11 @@ public void stopRecording() {
@Override
public void onPreviewFrame(byte[] data, Camera camera) {
try {
if (audioRecord == null || audioRecord.getRecordingState() != AudioRecord.RECORDSTATE_RECORDING) {
// 去掉必须录制音频的限制,可以录制无声视频
// if (audioRecord == null || audioRecord.getRecordingState() != AudioRecord.RECORDSTATE_RECORDING) {
// startTime = System.currentTimeMillis();
return;
}
// return;
// }
if (RECORD_LENGTH > 0) {
int i = imagesIndex++ % images.length;
yuvImage = images[i];
Expand Down

0 comments on commit a011f01

Please sign in to comment.