kevinresol / react-native-sound-recorder

Simplest Sound Recorder for React Native
MIT License
119 stars 36 forks source link

record file not played ofter upload to amazon s3 ~ mp4 #7

Closed MorMeshulam closed 6 years ago

MorMeshulam commented 6 years ago

HEY, first thanks for the great code.

i tried to use this module lately and i have a problem. right after i record the file its uploaded to amazon s3 and some how the file seem to be corrupt in the cloud. BUT after i download it and force it to play by quicktime it is played well. any other players or the android player itself didn't played it.

sample file https://s3.eu-west-3.amazonaws.com/reactfirebasebucket/uploads/test.mp4

any help would be great :)

kevinresol commented 6 years ago

I can play it on my android phone

kirillplatonov commented 6 years ago

@MorMeshulam I had the same issue. Audio not played in browser and popular web video players. Try set format and encoder for android. Example from my app:

let options = {
  bitRate: 128000,
  channels: 2,
  sampleRate: 44100,
}
if (Platform.OS === 'android') {
  options['format'] = SoundRecorder.FORMAT_MPEG_4
  options['encoder'] = SoundRecorder.ENCODER_AAC
}
SoundRecorder.start(path, options)
kevinresol commented 6 years ago

I did the same thing as @kirillplatonov (but forgot to post it here) and it should work fine cross-platform.

danielidt commented 4 years ago

for some reason audio recorded on ios is not playing for me on web or android devices but audio recorded on android plays on web and on ios devices.

prior to attempting the settings posted by @kirillplatonov, audio recorded through android was also not working, however these settings resolved that. IOS is still a no go, any other ideas?

how do we set the format on ios? same constants?

danielidt commented 4 years ago

my problem seems to be the AAC encoder. I can set this for android but not for IOS

kevinresol commented 4 years ago

You only need to set the encoder to AAC on android. You can just use the default options in ios. Please follow the config snippet above by @kirillplatonov

danielidt commented 4 years ago

@kevinresol i did, the resulting file in BASE64, when recorded on IOS and saved to a server and then downloaded to play on a browser, OR on an android device, will not play. In fact, the same can be said for an android recording that does not contain the settings @kirillplatonov posted. When adding those settings, it is fixed for android but not for IOS.

After doing some research, it seems it is a common issue with ios recordings and multiple libraries. I have also tried every single format provided for IOS, to no success.

If you manage to get an IOS recording to work for you on android or web, please provide your settings

danielidt commented 4 years ago

update: for anyone else experiencing this issue, expo-av works fine when converting the recording to base64

kevinresol commented 4 years ago

My code is basically the same as @kirillplatonov 's, except I don't set bitRate, channels & sampleRate