Audio recorded with Samsung does not play on iOS

818 Views Asked by At

I'm developing an Audio app that allows record micro to an mp3 file. Then it allows to play the audio file. On Android, I'm using this code:

    mRecorder = new MediaRecorder();
    mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
    mRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
    mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
    mRecorder.setOutputFile("path/audio.mp3");

    try {

        mRecorder.prepare();
        mRecorder.start();
    } catch (Exception e) {

        LogUtil.e("startRecording", e.getMessage());
    }

I can play the recorded audio on iOS if my app ran on Nexus 5 device but I can't if ran on Samsung S3/S5.

Sorry about my bad english, if you can't understand well the description, please check bellow sum:

  • Audio recorded by above code with Nexus 5 => can play on iOS
  • Audio recorded by above code with Samsung S3/S5 => can't play on iOS

How can I play the audio recorded by Samsung devices on iOS ? Please help me.

1

There are 1 best solutions below

0
On

If you want to play these files using streaming then you can go through my answer- Audio file is having metadata that allow this to stream, in some devices like samsung this is at end of the file. You need to move this metadata to start of file to make the file streamable. To do so you can use MP4Box.