android.media.MediaRecorder.reset()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(5.0k)|赞(0)|评价(0)|浏览(277)

本文整理了Java中android.media.MediaRecorder.reset()方法的一些代码示例,展示了MediaRecorder.reset()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MediaRecorder.reset()方法的具体详情如下:
包路径:android.media.MediaRecorder
类名称:MediaRecorder
方法名:reset

MediaRecorder.reset介绍

暂无

代码示例

代码示例来源:origin: florent37/CameraFragment

protected void releaseVideoRecorder() {
  try {
    if (videoRecorder != null) {
      videoRecorder.reset();
      videoRecorder.release();
    }
  } catch (Exception ignore) {
  } finally {
    videoRecorder = null;
  }
}

代码示例来源:origin: guardianproject/haven

private void releaseMediaRecorder() {
    if(mMediaRecorder != null){
      mMediaRecorder.reset();
      mMediaRecorder.release();
      mMediaRecorder = null;
      mCamera.lock();
    }
  }
}

代码示例来源:origin: commonsguy/cw-omnibus

recorder.reset();

代码示例来源:origin: commonsguy/cw-omnibus

recorder.reset();

代码示例来源:origin: robolectric/robolectric

@Test
public void testReset() throws Exception {
 mediaRecorder.start();
 assertThat(shadowMediaRecorder.getState()).isEqualTo(ShadowMediaRecorder.STATE_RECORDING);
 mediaRecorder.reset();
 assertThat(shadowMediaRecorder.getState()).isEqualTo(ShadowMediaRecorder.STATE_INITIAL);
}

代码示例来源:origin: robolectric/robolectric

@Test
public void testRelease() throws Exception {
 mediaRecorder.start();
 mediaRecorder.reset();
 assertThat(shadowMediaRecorder.getState()).isEqualTo(ShadowMediaRecorder.STATE_INITIAL);
 mediaRecorder.release();
 assertThat(shadowMediaRecorder.getState()).isEqualTo(ShadowMediaRecorder.STATE_RELEASED);
}

代码示例来源:origin: stackoverflow.com

visualizerView.clear();
recorder.stop();
recorder.reset();
recorder.release();
recorder = null;

代码示例来源:origin: stackoverflow.com

mrec.reset();   // clear recorder configuration

代码示例来源:origin: stackoverflow.com

mediaRecorder.reset();
mediaRecorder.release();

代码示例来源:origin: willowtreeapps/Hyperion-Android

static void reset() {
  mediaRecorder.reset();
  if (!new File(outputPath).delete()) {
    Log.e(TAG, "Failed to remove placeholder " + outputPath);
  }
}

代码示例来源:origin: guoxiaoxing/phoenix

protected void releaseVideoRecorder() {
  try {
    if (mMediaRecorder != null) {
      mMediaRecorder.reset();
      mMediaRecorder.release();
    }
  } catch (Exception ignore) {
  } finally {
    mMediaRecorder = null;
  }
}

代码示例来源:origin: willowtreeapps/Hyperion-Android

@Override
  public void onStop() {
    if (recording) {
      mediaRecorder.stop();
      mediaRecorder.reset();
    }
    mediaProjection = null;
    stopScreenSharing();
    setRecording(false);
  }
}

代码示例来源:origin: googlesamples/android-Camera2Video

private void stopRecordingVideo() {
  // UI
  mIsRecordingVideo = false;
  mButtonVideo.setText(R.string.record);
  // Stop recording
  mMediaRecorder.stop();
  mMediaRecorder.reset();
  Activity activity = getActivity();
  if (null != activity) {
    Toast.makeText(activity, "Video saved: " + mNextVideoAbsolutePath,
        Toast.LENGTH_SHORT).show();
    Log.d(TAG, "Video saved: " + mNextVideoAbsolutePath);
  }
  mNextVideoAbsolutePath = null;
  startPreview();
}

代码示例来源:origin: Piasy/RxAndroidAudio

mRecorder.reset();
} catch (RuntimeException e) {
  Log.w(TAG, "stopRecord fail, reset fail " + e.getMessage());

代码示例来源:origin: willowtreeapps/Hyperion-Android

static void stop() throws RecordingException {
  try {
    mediaRecorder.stop();
    mediaRecorder.reset();
    stopScreenSharing();
  } catch (RuntimeException ex) {
    throw new RecordingException("Failed to stop media recorder.", ex);
  } finally {
    setRecording(false);
  }
}

代码示例来源:origin: Piasy/RxAndroidAudio

/**
 * After prepared, start record now.
 */
@WorkerThread
public synchronized boolean startRecord() {
  if (mRecorder == null || mState != STATE_PREPARED) {
    setError(ERROR_NOT_PREPARED);
    return false;
  }
  // Handle RuntimeException if the recording couldn't start
  try {
    mRecorder.start();
    mStarted = true;
  } catch (RuntimeException exception) {
    Log.w(TAG, "startRecord fail, start fail: " + exception.getMessage());
    setError(ERROR_INTERNAL);
    mRecorder.reset();
    mRecorder.release();
    mRecorder = null;
    mStarted = false;
    return false;
  }
  mSampleStart = System.currentTimeMillis();
  mState = STATE_RECORDING;
  return true;
}

代码示例来源:origin: Piasy/RxAndroidAudio

Log.w(TAG, "startRecord fail, prepare fail: " + exception.getMessage());
setError(ERROR_INTERNAL);
mRecorder.reset();
mRecorder.release();
mRecorder = null;
Log.w(TAG, "startRecord fail, start fail: " + exception.getMessage());
setError(ERROR_INTERNAL);
mRecorder.reset();
mRecorder.release();
mRecorder = null;

代码示例来源:origin: Piasy/RxAndroidAudio

/**
 * prepare for a new audio record.
 */
@WorkerThread
public synchronized boolean prepareRecord(int audioSource, int outputFormat, int audioEncoder,
    int sampleRate, int bitRate, File outputFile) {
  stopRecord();
  mRecorder = new MediaRecorder();
  mRecorder.setAudioSource(audioSource);
  mRecorder.setOutputFormat(outputFormat);
  mRecorder.setAudioSamplingRate(sampleRate);
  mRecorder.setAudioEncodingBitRate(bitRate);
  mRecorder.setAudioEncoder(audioEncoder);
  mRecorder.setOutputFile(outputFile.getAbsolutePath());
  // Handle IOException
  try {
    mRecorder.prepare();
  } catch (IOException exception) {
    Log.w(TAG, "startRecord fail, prepare fail: " + exception.getMessage());
    setError(ERROR_INTERNAL);
    mRecorder.reset();
    mRecorder.release();
    mRecorder = null;
    return false;
  }
  mState = STATE_PREPARED;
  return true;
}

代码示例来源:origin: stackoverflow.com

if(null != recorder){
  recorder.stop();
  recorder.reset();
  recorder.release();

代码示例来源:origin: stackoverflow.com

if (mMediaRecorder != null) {
  mMediaRecorder.stop();
  mMediaRecorder.reset();

相关文章