hyochan / react-native-audio-recorder-player

react-native native module for audio recorder and player.
MIT License
689 stars 204 forks source link

.wav file support #276

Open ravi0the0sun opened 3 years ago

ravi0the0sun commented 3 years ago

Version of react-native-audio-recorder-player

"react-native-audio-recorder-player": "^2.6.2"

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

IOS

Expected behavior

When provided with a URL link to a .wav file audio in audioRecorderPlayer.startPlayer(URL) function noting happens.

Actual behavior

Should have played the audio.

Steps to reprodue the behabior

const startPlay = async () => {
        try {
            console.log('start play');
            const result = await audioRecorderPlayer.startPlayer(
                'https://ipfs.io/ipfs/QmXLvrtWcHcZrLt89HQpJAcwpjhsCP1dTfeLKFNzCGUomt' // wav file
                // 'https://ipfs.io/ipfs/QmWcz9LhKmfFBiFeGye2fpGvr8MPpu7oodT81LUdzmrAMC' // mp3 file 
            );
            audioRecorderPlayer.addPlayBackListener(e => {});
            console.log('start play', result);
        } catch (err) {
            console.error(err);
        }
    };

when we use the url for the wav file the player does not play anything

Request

can we get support on saving the recordings in .mp3 or .wav file. Thank you for this package.

React Native Project info

System:
    OS: macOS 10.15.7
    CPU: (4) x64 Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
    Memory: 430.08 MB / 16.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 14.15.1 - /var/folders/nf/83z965450dd46qzdlrd86t6h0000gn/T/fnm_multishells/41875_1619338230902/bin/node
    Yarn: 1.22.10 - /var/folders/nf/83z965450dd46qzdlrd86t6h0000gn/T/fnm_multishells/41875_1619338230902/bin/yarn
    npm: 6.14.13 - /var/folders/nf/83z965450dd46qzdlrd86t6h0000gn/T/fnm_multishells/41875_1619338230902/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.10.1 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 14.2, DriverKit 19.0, macOS 10.15, tvOS 14.2, watchOS 7.1
    Android SDK:
      API Levels: 23, 28, 29, 30
      Build Tools: 28.0.3, 29.0.2, 29.0.3, 30.0.2
      System Images: android-28 | Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom_64, android-28 | Google Play Intel x86 Atom_64, android-29 | Intel x86 Atom_64, android-29 | Google APIs Intel x86 Atom_64, android-29 | Google Play Intel x86 Atom_64, android-30 | Google APIs Intel x86 Atom_64, android-30 | Google Play Intel x86 Atom_64
      Android NDK: Not Found
  IDEs:
    Android Studio: 4.1 AI-201.8743.12.41.7042882
    Xcode: 12.1.1/12A7605b - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.10 - /usr/bin/javac
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.13.1 => 16.13.1 
    react-native: 0.63.4 => 0.63.4 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found
davidburson commented 2 months ago

I just tried to play a .wav file on iOS 16.7.7 with rnarp 3.6.7. Nothing happened, no error, nothing. Did I do something wrong, or is that the current expected behavior?

davidburson commented 2 months ago

Sorry, I did something wrong. With this audioSet it worked:

const audioSet = {
        AudioEncoderAndroid: AudioEncoderAndroidType.DEFAULT,
        AudioSourceAndroid: AudioSourceAndroidType.MIC,
        AVModeIOS: AVModeIOSOption.measurement,
        AVEncoderAudioQualityKeyIOS: AVEncoderAudioQualityIOSType.low,
        AVNumberOfChannelsKeyIOS: 1,
        AVFormatIDKeyIOS: AVEncodingOption.wav,
      };

So now my question is, why is this issue still open?