2017-11-10 4 views
2

i'veを再生し、ファイルタイプを」.MP3" に設定doesntのファイルを実際のmp3を作成しますが、 ".3gp"は私にも意味がありません。オーディオはビデオではありません。)アンドロイド:MediaRecorder使って録音オーディオ - 私はそれがdoesntのことを知っている(<a href="https://developer.android.com/guide/topics/media/mediarecorder.html" rel="nofollow noreferrer">MediaRecorder</a></p> <p>また、私が追加したいくつかのプロパティを使用してGoogleから直接サンプルコードを実装

私のファイルを再生したい場合、何もしません。 00秒)。私はファイルのプロパティをチェックし、ストレージ上のスペースを埋める。

追加:とにかく

私は録音中に視覚的なフィードバックを実装したいです。 Horizonは唯一の見栄えの良いライブラリのようです。しかし、Horizo​​nを使用すると、Audiorecorderのバッファを使用する必要があります。これはMediaRecoderでは不可能です。 MediaRecorderで現在録音されているオーディオを視覚化する、見た目の良いライブラリを誰かが知っていますか?

private void startRecording() { 
    if(this.mRecorder != null) 
     return; 

    String fileToWrite = this.ProjectDirPath + File.separator + GetToday() + this.fileTpye; 

    mRecorder = new MediaRecorder(); 
    mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC); 
    mRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4); 
    mRecorder.setOutputFile(fileToWrite); 
    mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.HE_AAC); 
    mRecorder.setAudioSamplingRate(16000); 
    mRecorder.setAudioEncodingBitRate(44100); 
    mRecorder.setAudioChannels(1); 

    try { 
     mRecorder.prepare(); 
    }catch (IOException e) { 
     Log.e("startRecording()", "prepare() failed"); 
    } 

    initRecorder(); 
    mRecorder.start(); 
    isRecording = true; 
} 



private void stopRecording() { 
    if(this.mRecorder == null) 
     return; 
    else{ 
     try{ 
      mRecorder.stop(); 
      mRecorder.release(); 
      mRecorder = null; 
      isRecording = false; 
      this.updateListView(); 
     } catch(Exception e){ 
      mRecorder = null; 
      isRecording = false; 
     } 
    } 
} 

public static String GetToday(){ 
    Date presentTime_Date = Calendar.getInstance().getTime(); 
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 
    return dateFormat.format(presentTime_Date); 
} 

非常

ありがとう権限はマニフェストにし、実行時に設定されています。

答えて

関連する問題

 関連する問題