Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ios recorder audio is m4a and android recorded is mp4 #588

Open
DevHamzaShahid opened this issue Feb 16, 2024 · 5 comments
Open

Ios recorder audio is m4a and android recorded is mp4 #588

DevHamzaShahid opened this issue Feb 16, 2024 · 5 comments

Comments

@DevHamzaShahid
Copy link

Please fill the template to help you out. Also, please try the Example project compare before submiting the issue when you have certain issue with your project setup.

Version of react-native-audio-recorder-player

"react-native-audio-recorder-player": "^3.6.6",

Version of React Native"

"react-native": "0.73.1",

Platforms you faced the error (IOS or Android or both?)

in android

Expected behavior

Ios recorded audio is m4a which should also play in android

Actual behavior

android recorded audio is playing in both platforms as it is recorded with extension mp4
but ios recorded m4a audio is only playable on ios not when we play that audio in android
as i am working on chat app, so ios users are sending audio chat to android user then android users are unable to play

Steps to reproduce the behavior

@yernandus
Copy link

same thing. android is recording mp4

@LiuYiSong
Copy link

Yes, this is a very big problem. If Android and iOS files cannot be played together, it will be meaningless, so it is urgent to solve this problem

@TallNutAlt
Copy link

the same

@Irfan-S
Copy link

Irfan-S commented Mar 22, 2024

By saving files as .AAC on both iOS and Android, this issue can be worked around.

const audioSet: AudioSet = {
  AudioEncoderAndroid: AudioEncoderAndroidType.AAC,
  AudioSourceAndroid: AudioSourceAndroidType.MIC,
  AVEncoderAudioQualityKeyIOS: AVEncoderAudioQualityIOSType.high,
  AVNumberOfChannelsKeyIOS: 2,
  AVFormatIDKeyIOS: AVEncodingOption.aac,
};

This can then be passed in as a prop during recording, which then works on both devices

@TallNutAlt
Copy link

通过在 iOS 和 Android 上将文件保存为 .AAC,可以解决此问题。

const audioSet: AudioSet = {
  AudioEncoderAndroid: AudioEncoderAndroidType.AAC,
  AudioSourceAndroid: AudioSourceAndroidType.MIC,
  AVEncoderAudioQualityKeyIOS: AVEncoderAudioQualityIOSType.high,
  AVNumberOfChannelsKeyIOS: 2,
  AVFormatIDKeyIOS: AVEncodingOption.aac,
};

然后可以在录制期间将其作为道具传入,然后在两个设备上都可以使用

const audioSet = {
AudioEncoderAndroid: AudioEncoderAndroidType.AAC,
AudioSourceAndroid: AudioSourceAndroidType.MIC,
AVEncoderAudioQualityKeyIOS: AVEncoderAudioQualityIOSType.high,
AVNumberOfChannelsKeyIOS: 2,
AVFormatIDKeyIOS: AVEncodingOption.aac,
};
audioRecorderPlayer.startRecorder(undefined,audioSet).then(res => {
console.log(res);
setNextYuyin(true);
});
我尝试了一下 并没有变成 aac格式

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants