Streaming AAC audio with Android

后端 未结 5 906
遇见更好的自我
遇见更好的自我 2020-12-23 15:05

As I understand it, Android will only play AAC format audio if it\'s encoded as MPEG-4 or 3GPP.

I\'m able to play AAC audio encoded as M4A when it\'s local to the ap

5条回答
  •  心在旅途
    2020-12-23 15:34

    I found that if you record the audio file on Android with the following properties, you are then able to play it on your server. It also plays well in the HTML Audio Element, however only on Firefox at the moment. This may change in the future.

    Android (JAVA):

    mediaRecorder = new MediaRecorder();
    mediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
    mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
    mediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.HE_AAC);
    mediaRecorder.setAudioSamplingRate(44100);
    mediaRecorder.setAudioChannels(1);
    mediaRecorder.setOutputFile(filePath);
    

    HTML:

提交回复
热议问题