jsierles / react-native-audio

Audio recorder library for React Native
MIT License
1.16k stars 539 forks source link

AAC recorded in android doesn't play neither in Safari browser nor in iOS #308

Closed VadimCpp closed 5 years ago

VadimCpp commented 5 years ago

Version

Tell us which versions you are using ( you can see the versions in your package.json ):

react-native-audio : 4.3.0 react-native : 0.55.4 react : 16.3.1 using react-native-sound ? Yes

Expected behaviour :

I am recording an audio with params below:

AudioRecorder.prepareRecordingAtPath(action.payload, {
        SampleRate: 22050,
        Channels: 1,
        AudioQuality: 'Low',
        AudioEncoding: 'aac',
        AudioEncodingBitRate: 32000,
      });

I am getting audio.aac and play it on my website. I expect the audio file will play well in Chrome and Safari browsers.

Actual behaviour

The file playback works perfect in Chrome browser. The file playback does not work in Safari 😭

Steps to reproduce

No steps to reproduce. MediaInfo report of "audio.aac" instead:

General Complete name : audio.aac Format : MPEG-4 Format profile : Base Media / Version 2 Codec ID : mp42 (isom/mp42) File size : 64.5 KiB Duration : 15 s 929 ms Overall bit rate mode : Constant Overall bit rate : 33.2 kb/s Encoded date : UTC 2019-01-25 12:48:40 Tagged date : UTC 2019-01-25 12:48:40 com.android.version : 8.0.0 FileExtension_Invalid : mov mp4 m4v m4a m4b m4p 3ga 3gpa 3gpp 3gp 3gpp2 3g2 k3g jpm jpx mqv ismv isma ismt f4a f4b f4v

Audio ID : 1 Format : AAC LC Format/Info : Advanced Audio Codec Low Complexity Codec ID : mp4a-40-2-2 Duration : 15 s 929 ms Bit rate mode : Constant Bit rate : 32.0 kb/s Channel(s) : 1 channel Channel layout : C Sampling rate : 22.05 kHz Frame rate : 21.533 FPS (1024 SPF) Compression mode : Lossy / Lossy Stream size : 62.4 KiB (97%) Title : SoundHandle Language : English Encoded date : UTC 2019-01-25 12:48:40 Tagged date : UTC 2019-01-25 12:48:40

Link to a git repo that reproduces bug

N/A. The code works well. Need to understand whether it possible to set correct recording settings.

Possible clone: https://github.com/jsierles/react-native-audio/issues/236

VadimCpp commented 5 years ago

This is the fix: https://github.com/jsierles/react-native-audio/issues/161#issuecomment-331137268