Audio format for iOS and Android

前端 未结 7 1484
故里飘歌
故里飘歌 2020-11-30 21:45

Sorry if I am asking too generic question.

We are in the process of developing an application which records and plays audio on mobile devices. This application is be

7条回答
  •  不知归路
    2020-11-30 22:18

    We recently faced this interoperability issue. We were trying to record a file in aac format in both platforms but the files recorded using Samsung handsets were not played in iOS. So we had to use both 3gp as well as aac formats in order to play the file across multiple devices in android and ios.

    Following is the code that we used when recording a file in Android:

        mRecorder = new MediaRecorder();
        mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
        mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
        mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
        mRecorder.setOutputFile(fileName);
    

    We kept the extension of the recorded file as .3gp.

    In iOS, however the recording can not be performed in 3gp so we recorded file in .aac in iOS which can be played in both the platforms.

提交回复
热议问题