Giter VIP home page Giter VIP logo

react-native-audio's Introduction

react-native-audio for iOS and android

An audio recording and playback library for React Native iOS apps.

On iOS, it supports most iOS AVAudioRecorder class configuration options.

Installation

Install the package via npm, and link the binary to your iOS and Android projects:

npm install react-native-audio
react-native link react-native-audio

Extra Android installation step

Update AndroidManifest.xml by adding the RECORD_AUDIO permission:

<uses-permission android:name="android.permission.RECORD_AUDIO" />

Running the Sample App On iOS

In the AudioExample directory:

npm install
react-native run-ios

Running the Sample App On Android

In the AudioExample directory:

npm install
react-native run-android

Usage

This library supports recording, basic playback and progress reporting. Progress reporting is iOS only for now.

To record in AAC format, at 22050 KHz in low quality mono with metering enabled:

import {AudioRecorder, AudioUtils} from 'react-native-audio';
let audioPath = AudioUtils.DocumentDirectoryPath + '/test.aac';

AudioRecorder.prepareRecordingAtPath(audioPath, {
  SampleRate: 22050,
  Channels: 1,
  AudioQuality: "Low",
  AudioEncoding: "aac",
  MeteringEnabled: true
});

See the example for more options, including playback and callbacks. For more audio play options, check out React Native Sound

Supported audio formats

A subset of formats listed here are supported: https://developer.apple.com/reference/coreaudio/1572096-audio_data_format_identifiers

Currently supported format arguments: lpcm, ima4, aac, MAC3, MAC6, ulaw, alaw, mp1, mp2, alac.

MP3 recording is not supported on iOS.

Thanks to Brent Vatne, Johannes Lumpe, Kureev Alexey and Matthew Hartman for their assistance.

Progress tracking code borrowed from https://github.com/brentvatne/react-native-video.

react-native-audio's People

Contributors

jsierles avatar wootwoot1234 avatar hartmamt avatar tommoor avatar rakannimer avatar rcchen avatar aadidenko avatar tianquliu avatar lennonr avatar maxhawkins avatar getsetbro avatar akio0o avatar vaukalak avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.