Git Product home page Git Product logo

react-native-audio-toolkit's Introduction

banner

npm version

This is a cross-platform (Android and iOS) audio library for React Native. Both audio playback and recording is supported. In addition to basic functionality, many useful features are implemented such as seeking, looping and streaming audio files over the network.

An example how to use this library is included in the ExampleApp directory. The demo showcases most of the functionality that is available, with documentation under docs. In the simplest case, playing media is as easy as:

new Player('filename.mp4').play();

and recording media to filename.mp4 similarly

new Recorder(‘filename.mp4’).record();

How to get this stuff running?

Documentation

License

All JavaScript, Android and iOS code licensed under MIT license, see LICENSE file. Some of the files are from React Native templates and are licensed accordingly.

react-native-audio-toolkit's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-native-audio-toolkit's Issues

Can't get file to play

I'm very new to Xcode and react-native. I'm pretty curtain I followed the installation instructions correctly. I'm using a simulator to test the plugin. Here is my code.

import {
Player,
Recorder,
MediaStates
} from 'react-native-audio-toolkit';

import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
TouchableHighlight
} from 'react-native';

class nusiqcom extends Component {

_onPress() {

  new Player("https://mdn.mozillademos.org/files/2587/AudioTest%20(1).mp3").play()

}
render() {
return (

  <View style={styles.basic}>
  <TouchableHighlight onPress={() => this._onPress()}>
    <Text>
      Press me!
    </Text>
  </TouchableHighlight>
  </View>
);

}
}

var styles = {
basic: {
flex: 1,
justifyContent: 'center',
alignItems: 'center'
}
}

AppRegistry.registerComponent('nusiqcom', () => nusiqcom);

I'm not sure where I'm going wrong. I'm using react-native 0.39.0 if that matters. Any help is appreciated. Thank you.

method does not override or implement a method from a supertype

When I try to build for android, I get this error:

:react-native-audio-toolkit:incrementalReleaseJavaCompilationSafeguard
:react-native-audio-toolkit:compileReleaseJavaWithJavac
:react-native-audio-toolkit:compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
/Users/zoe/Developer/podcast/node_modules/react-native-audio-toolkit/android/lib/src/main/java/com/futurice/rctaudiotoolkit/AudioPackage.java:22: error: method does not override or implement a method from a supertype
    @Override
    ^
1 error
:react-native-audio-toolkit:compileReleaseJavaWithJavac FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-audio-toolkit:compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

However if I run on IOS it works just fine.

I have followed the instructions for installing on android.

Example App Error [Android]

Guys, I am really goin nuts in making just the example app to run. I am getting these errors while npm install in ExampleApp directory which i think is the culprit why my actual build is failing using react-native run-android. Can anyone please help me out? Attached is the log from my terminal during npm install log.txt

Can't play M4A

play returns successfully but duration and currentTime return 0 with no sound. Can the supported audio formats be documented somewhere?

Play multiple files

What is the best way to play a list of audios recorded in sequence? I would have waited for "duration", but that property is -1 into the Player object; should I use .on('ended', ...)?
Thank you so much

Crash on javascript reload

It's crashing when reloading javascript

stacktrace

11-07 16:32:49.940 19681-19681/? E/AndroidRuntime: FATAL EXCEPTION: main
                                                   Process: com.gambit, PID: 19681
                                                   java.lang.IllegalStateException
                                                       at android.media.MediaPlayer.getAudioSessionId(Native Method)
                                                       at com.futurice.rctaudiotoolkit.AudioPlayerModule.getInfo(AudioPlayerModule.java:218)
                                                       at com.futurice.rctaudiotoolkit.AudioPlayerModule.onHostPause(AudioPlayerModule.java:67)
                                                       at com.facebook.react.bridge.ReactContext.onHostPause(ReactContext.java:228)
                                                       at com.facebook.react.XReactInstanceManagerImpl.tearDownReactContext(XReactInstanceManagerImpl.java:827)
                                                       at com.facebook.react.XReactInstanceManagerImpl.access$500(XReactInstanceManagerImpl.java:110)
                                                       at com.facebook.react.XReactInstanceManagerImpl$ReactContextInitAsyncTask.onPreExecute(XReactInstanceManagerImpl.java:198)
                                                       at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:604)
                                                       at com.facebook.react.XReactInstanceManagerImpl.recreateReactContextInBackground(XReactInstanceManagerImpl.java:755)
                                                       at com.facebook.react.XReactInstanceManagerImpl.onJSBundleLoadedFromServer(XReactInstanceManagerImpl.java:738)
                                                       at com.facebook.react.XReactInstanceManagerImpl.access$100(XReactInstanceManagerImpl.java:110)
                                                       at com.facebook.react.XReactInstanceManagerImpl$1.onJSBundleLoadedFromServer(XReactInstanceManagerImpl.java:152)
                                                       at com.facebook.react.devsupport.DevSupportManagerImpl$19$1.run(DevSupportManagerImpl.java:747)
                                                       at android.os.Handler.handleCallback(Handler.java:739)
                                                       at android.os.Handler.dispatchMessage(Handler.java:95)
                                                       at android.os.Looper.loop(Looper.java:148)
                                                       at android.app.ActivityThread.main(ActivityThread.java:5417)
                                                       at java.lang.reflect.Method.invoke(Native Method)
                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Audio toolkit player prepares before audio from online is loaded (iOS only)

Having an issue where the audio toolkit player prepares before the audio has actually loaded on iOS devices (Functions as should on Android).

This means that when player.play is called after it has prepared, there is a delay in sound being heard. The following example shows that isPlaying is true before audio is playing.

    this.player = new Player('http://ia601406.us.archive.org/14/items/TaransFreeJazzHour5mai07/5mai07.mp3')
    this.player.prepare(e => {
      if (e) {
        console.warn(e.message)
      } else {
        this.playAudio()
        this.interval = setInterval(() => {
          console.log(
            this.player.currentTime,
            this.player.canPlay,
            this.player.canStop,
            this.player.canPrepare,
            this.player.isPlaying,
            this.player.isStopped,
            this.player.isPaused,
          )
        }, 100)
      }
    })
  }

  playAudio () {
    this.player.play((err) => {
      if (err) console.warn(err)
      console.log(this.player)
    })
  }

Pause broken

I noticed when calling pause() or playPause() that the sound stops but the currentTime keeps incrementing and isPlaying still is true. My player will not pause (at least the time) and I cannot resume playback either because the sound isn't playing.

https://github.com/futurice/react-native-audio-toolkit/blob/master/src/Player.js#L164

  pause(callback = _.noop) {
    RCTAudioPlayer.pause(this._playerId, (err, results) => {
      //this._updateState(err, MediaStates.PAUSED, [results]); // We are sending a pause event on the native side
      callback(err);
    });

    return this;
  }

Why is _updateState commented out? Every other call (stop, play, etc) has it called. I uncommented it and now my player is working as expected.

I see it was changed, but I don't understand why or how it's supposed to work: 60f6005#diff-57dfd10e73b05f2ac7dda337ab53d555R164

android .aac format shorter than expected

Hi, If we record a audio with .aac format on Android, it always shorter than it supposed to be, for example,
we record a 15 second audio, but the generated audio file only 7 seconds length.

audio-toolkit version :1.0.5 .

Not able to Play from network in Android.throwing error

3613-8999/com.audiotest E/AudioPlayerModule: playerId 0 not found.
11-30 15:54:31.764 3613-8999/com.audiotest D/AudioPlayerModule: dalvik.system.VMStack.getThreadStackTrace(Native Method)
java.lang.Thread.getStackTrace(Thread.java:580)
com.futurice.rctaudiotoolkit.AudioPlayerModule.errObj(AudioPlayerModule.java:105)
com.futurice.rctaudiotoolkit.AudioPlayerModule.errObj(AudioPlayerModule.java:125)
com.futurice.rctaudiotoolkit.AudioPlayerModule.play(AudioPlayerModule.java:353)
java.lang.reflect.Method.invoke(Native Method)
java.lang.reflect.Method.invoke(Method.java:372)
com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:363)
com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:166)
com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
android.os.Handler.handleCallback(Handler.java:739)
android.os.Handler.dispatchMessage(Handler.java:95)
com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
android.os.Looper.loop(Looper.java:135)
com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:194)
java.lang.Thread.run(Thread.java:818) #

Issue with Battery Saving Mode

Hey,
I'm facing with an issue on my OnePlus3 and battery saving mode. If I switch over to the next song, which is loaded via an remote url while the app is in background (I'm using react-native-music-controls to switch the song), the song doesn't get loaded. I need to go back to the app, otherwise the song won't load. The app isn't killed, so it seems like a problem with the native download function. It works fine again if I turn off the battery saving mode. Also local saved songs are working fine even if battery saving mode was turned on. Any idea what we need to change?

play network file

Thanks for making another useful toolkit! (I'm using the pepperoni app starter kit and like the framework very much.)

I wonder if it is possible to download an audio file first with react-native-fetch-blob for example, and then play it with this module?

I have searched a lot but didn't find any existing toolkit which can play audio from url on both iOS and Android.

It won't work... :(

I was REALLY excited when I found your project. Finally a cross-platform react-native audio player! I followed the directions exactly, fired it up, click on a button, and no sound...

Ok, so obviously I did something wrong. Let's run the example app. Except, it won't compile...

https://cloudup.com/czuZa2Xv_Ho

Sadness fell upon me. I need this to work! Any ideas?

problem with audio list

<Button onPress={this._playPause.bind(this)}>
{this.state.playPauseButton}
</Button>
<Button onPress={this._playPause.bind(this)}>
{this.state.playPauseButton}
</Button>

_playPause() {
this.player.playPause((err, playing) => {
if (err) {
this.setState({
error: err.message
});
}
});
the problem is when i click on the 1rst button the audio is playing, and if i click the 2nd button both audio is playing in same time, and i can't stop or pause the first audio.
i console.log(this.player) firtst button => _playerId: 0, but in second button => _playerId: 1,

player.hasLoaded

Is there something so that I can see when a large non-local audio file has been loaded so that it can play? For instance if I wanted to play a podcast, there is about 2-3 seconds between when the podcast loads onto the device and the device actually plays the audio.

Thanks for the great module!

Play audio after record issue

Hi,

I followed the example and created a recording modal for my app. After recording the audio clip it plays fine for the first time only. Playing the clip again does not play the clip. Not able to understand what's going wrong.

Here is the code:

  constructor(props) {
    super(props);
    this.state = {
      playPauseButton: null,
      recordButton: null,
      stopButtonDisabled: true,
      playButtonDisabled: true,
      recordButtonDisabled: true,
      progress: 0,
      error: null,
      audioFileName: props.audioFileName
    };
  }

  componentWillMount() {
    this.progressInterval = setInterval(() => {
      if (this.player && this.shouldUpdateProgressBar()) {
        this.setState({ progress: Math.max(0, this.player.currentTime) / this.player.duration });
      }
    }, 100);
  }

  componentWillReceiveProps(nextProps) {
    //reset the statusSelected every time the component becomes visible
    if (nextProps.resetRecorder) {
      this.setState({
        playPauseButton: null,
        recordButton: null,
        stopButtonDisabled: true,
        playButtonDisabled: true,
        recordButtonDisabled: true,
        progress: 0,
        error: null,
        audioFileName: nextProps.audioFileName
      });

      this.player = null;
      this.recorder = null;
      this.lastSeek = 0;

      this.reloadPlayer(nextProps.audioFileName);
      this.reloadRecorder(nextProps.audioFileName);
    }
  }

  componentWillUnmount() {
    clearInterval(this.progressInterval);
  }

  shouldUpdateProgressBar() {
    // Debounce progress bar update by 200 ms
    return moment().valueOf() - this.lastSeek > 200;
  }

  updateState() {
    this.setState({
      playPauseButton: this.player && this.player.isPlaying ? 'pause' : 'play',
      recordButton: this.recorder && this.recorder.isRecording ? 'stop' : 'circle',
      stopButtonDisabled: !this.player || !this.player.canStop,
      playButtonDisabled: !this.player || !this.player.canPlay || this.recorder.isRecording,
      recordButtonDisabled: !this.recorder || (this.player && !this.player.isStopped),
    });
  }//end of updateState

  playPause() {
    this.player.playPause((err, playing) => {
      if (err) {
        this.setState({
          error: err.message
        });
      }
      this.updateState();
    });
  }//end of playPause

  stop() {
    this.player.stop(() => {
      this.updateState();
    });
  }//end fo stop

  reloadPlayer(audioFileName) {
    if (this.player) {
      this.player.destroy();
    }

    this.player = new Player(audioFileName, {
      autoDestroy: false
    }).prepare((err) => {
      if (err) {
        this.setState({
          error: err.message
        });
      }
      this.updateState();
    });

    this.updateState();

    this.player.on('ended', () => {
      this.updateState();
    });
    this.player.on('pause', () => {
      this.updateState();
    });
  }//end of reloadPlayer

  reloadRecorder(audioFileName) {
    if (this.recorder) {
      this.recorder.destroy();
    }

    this.recorder = new Recorder(audioFileName, {
      bitrate: 128000,
      channels: 2,
      sampleRate: 44100,
      quality: 'medium',
    }).prepare((err, fsPath) => {
      console.log('reloadRecorder recorder prepare fsPath', fsPath);
      if (err) {
        this.setState({
          error: err.message
        });
      }

      this.updateState();
    });

    this.updateState();
  }//end of reloadRecorder

  toggleRecord() {
    if (this.player) {
      this.player.destroy();
    }

    this.recorder.toggleRecord((err, stopped) => {
      if (err) {
        console.log(err);
        this.setState({
          error: err.message
        });
      }
      if (stopped) {
        this.reloadPlayer(this.state.audioFileName);
        this.reloadRecorder(this.state.audioFileName);
      }

      this.updateState();
    });
  }//end of toggleRecord

  seek(percentage) {
    if (!this.player) {
      return;
    }

    this.lastSeek = moment().valueOf();
    const position = percentage * this.player.duration;

    this.player.seek(position, () => {
      this.updateState();
    });
  }//end of seek

[Feature request] Buffering event

Hello! Thanks for the awesome lib! So far best of those I've discovered on sounds.

Is it possible to send event "buffering" from java and ios?

I see there's no support for this now. Can you implement it or give some hints for java and ios? I would be glad to send PR.

AVPlayer status is unreliable

There's a fundamental issue with AVPlayer's status property, in that if you're loading from a remote file, the player reports that it's ready to play when indeed it is not.

The "correct" way to determine if the sound file will begin playing immediately is to check the current item's loadedTimeRanges to see if the data is available.

See this discussion for example code and more details.

https://stackoverflow.com/questions/5401437/knowing-when-avplayer-object-is-ready-to-play

Duration isn't immediately available after `.play()` is called

On iOS (I haven't tested Android yet), when you create a new player and call play:

const player = new Player('song.m4a');

console.log(player.duration) // -1

but a split second later, the duration value is there.

Not sure the best way to handle this. Maybe play is asynchronous and doesn't resolve until duration is available?

Thoughts here?

RCTJSONStringify Error when playing stream

Hello!
I'am running in to an issue where I'am receiving the error message:

RCTJSONStringify() encountered the following error: Invalid number value (NaN) in JSON write
reactConsoleErrorHandler @ ExceptionsManager.js:71
console.error @ YellowBox.js:67
logToConsole @ RCTLog.js:45
logIfNoNativeHook @ RCTLog.js:31
__callFunction @ MessageQueue.js:245
(anonymous) @ MessageQueue.js:101
__guard @ MessageQueue.js:213
callFunctionReturnFlushedQueue @ MessageQueue.js:100
(anonymous) @ debuggerWorker.js:71

This only occurs when I'am streaming from an IceCast server MP3 stream. The error does not occur if I use a mp3 url from cloudfront.

Setup to reproduce the error:

import {
    Player
} from 'react-native-audio-toolkit';

let url = 'http://webradio.antennevorarlberg.at/live';
let p = new Player(url, {
  autoDestroy: true,
  continuesToPlayInBackground: true
});
p.play();

In the Info.plist add:

<key>NSExceptionDomains</key>
<dict>
    <key>antennevorarlberg.at</key>
    <dict>
        <key>NSExceptionAllowsInsecureHTTPLoads</key>
        <true/>
        <key>NSIncludeSubdomains</key>
        <true/>
    </dict>
</dict>

My guess is React Native is not liking it when 0 is being passed as the duration, since the streams have no set end time. I have not tested this on Android yet.

Thank you for a great library! Please let me know if you need additional information about my setup.

Dependencies:
React: 16.0.0
React-Native: 0.45.1
React-Native-Audio-Toolkit: 1.0.5
iOS: 10
iPhone 6

Is this library still active?

I have 2 or more issues that i want to report and maybe open PRs for, but is this library still active and maintained?

OGG possible on Android?

I was trying to record ogg on Android,

this is my code:

const filename = 'test3.ogg';
const recorder = new Recorder(filename, {
  bitrate: 32000,
  channels: 1,
  sampleRate: 22050,
  quality: 'min',
  format: 'ogg', // autodetected
  encoder: 'webm', // autodetected
});

recorder.toggleRecord((err, stopped) => {
  if (err) console.error('failed reocrding, err:', err);
  else if (stopped) console.error('stopped recording');
  else console.error('started recording');
});

setTimeout(function() {
  recorder.toggleRecord((err, stopped) => {
    if (err) console.error('failed reocrding, err:', err);
    else if (stopped) console.error('stopped recording');
    else console.error('started recording');
  });
}, 5000)

However it is not working. The docs and code do look like it handles ogg though.

Track still plays in bg despite 'continuesToPlayInBackground' being false

The issue is addressed as is in the title. It happens on iOS, haven't tested on Android yet.

Here's my code:

this.player = new Player(data.preview_url, {continuesToPlayInBackground: false})

I back out of the app and it's still playing.
Note that I do not have the background audio permission on.

Project activity, future updates / releases

Hello @FruitieX is this project still alive, any info whether you plan to still support / maintain this library? I see that the master has new commits which haven't been released to npm and there's a PR that fixes build fails on RN 0.47.1 and above which too hasn't been merged to the master. Please let me know what are your plans for this project as I very much like the mediaplayer API implementation as it is implemented here.

Exception 'AVPlayerItem cannot service a seek request with a completion handler

Hey,
we get a lot of the following errors in our iOS application:

RCTFatalException: Exception 'AVPlayerItem cannot service a seek request with a completion handler until its status is AVPlayerItemStatusReadyToPlay.' was thrown while invoking seek on target AudioPlayer with params (
    7,
    0,
    4633
) Exception 'AVPlayerItem cannot service a seek request with a completion han... 

iOS Recorder stop callback is null

the stop callback works fine and return the expected value on Android.But it return null on iOS;

stopRecordAudio(){
      if(this.audioRecorder.isRecording){
        this.audioRecorder.stop((data)=>{
          console.log(data);
        })
      }
    }

React Native Version : 0.45.1;
Audio-Toolkit : 1.0.5;
Platform : iOS 10;

Build fails on RN 0.47.1

Here's the build log for RN 0.47.1 with RNCli 2.0.1 ->

╭─ashish at ashish-Inspiron-5520 in ~/test/SoundTester using ‹2.4.1›
╰─○ react-native run-android
Scanning 560 folders for symlinks in /home/ashish/test/SoundTester/node_modules (7ms)
JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug)...
Incremental java compilation is an incubating feature.
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:react-native-audio-toolkit:preBuild UP-TO-DATE
:react-native-audio-toolkit:preReleaseBuild UP-TO-DATE
:react-native-audio-toolkit:checkReleaseManifest
:react-native-audio-toolkit:preDebugAndroidTestBuild UP-TO-DATE
:react-native-audio-toolkit:preDebugBuild UP-TO-DATE
:react-native-audio-toolkit:preDebugUnitTestBuild UP-TO-DATE
:react-native-audio-toolkit:preReleaseUnitTestBuild UP-TO-DATE
:react-native-audio-toolkit:prepareComAndroidSupportAppcompatV72301Library
:react-native-audio-toolkit:prepareComAndroidSupportSupportV42301Library
:react-native-audio-toolkit:prepareComFacebookFbuiTextlayoutbuilderTextlayoutbuilder100Library
:react-native-audio-toolkit:prepareComFacebookFrescoDrawee101Library
:react-native-audio-toolkit:prepareComFacebookFrescoFbcore101Library
:react-native-audio-toolkit:prepareComFacebookFrescoFresco101Library
:react-native-audio-toolkit:prepareComFacebookFrescoImagepipeline101Library
:react-native-audio-toolkit:prepareComFacebookFrescoImagepipelineBase101Library
:react-native-audio-toolkit:prepareComFacebookFrescoImagepipelineOkhttp3101Library
:react-native-audio-toolkit:prepareComFacebookReactReactNative0471Library
:react-native-audio-toolkit:prepareComFacebookSoloaderSoloader010Library
:react-native-audio-toolkit:prepareOrgWebkitAndroidJscR174650Library
:react-native-audio-toolkit:prepareReleaseDependencies
:react-native-audio-toolkit:compileReleaseAidl
:react-native-audio-toolkit:compileReleaseNdk UP-TO-DATE
:react-native-audio-toolkit:compileLint
:react-native-audio-toolkit:copyReleaseLint UP-TO-DATE
:react-native-audio-toolkit:compileReleaseRenderscript
:react-native-audio-toolkit:generateReleaseBuildConfig
:react-native-audio-toolkit:generateReleaseResValues
:react-native-audio-toolkit:generateReleaseResources
:react-native-audio-toolkit:mergeReleaseResources
:react-native-audio-toolkit:processReleaseManifest
:react-native-audio-toolkit:processReleaseResources
:react-native-audio-toolkit:generateReleaseSources
:react-native-audio-toolkit:incrementalReleaseJavaCompilationSafeguard
:react-native-audio-toolkit:compileReleaseJavaWithJavac
:react-native-audio-toolkit:compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
/home/ashish/test/SoundTester/node_modules/react-native-audio-toolkit/android/lib/src/main/java/com/futurice/rctaudiotoolkit/AudioPackage.java:22: error: method does not override or implement a method from a supertype
    @Override
    ^
1 error
:react-native-audio-toolkit:compileReleaseJavaWithJavac FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-audio-toolkit:compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 21.0 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html

Next, I reverted to RN 0.46.1 with RNCli 2.0.1.
Here's the build log when using RN 0.46.1 with RNCli 2.0.1 ->

Scanning 560 folders for symlinks in /home/ashish/test/SoundTester/node_modules (8ms)
JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug)...
Incremental java compilation is an incubating feature.
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:react-native-audio-toolkit:preBuild UP-TO-DATE
:react-native-audio-toolkit:preReleaseBuild UP-TO-DATE
:react-native-audio-toolkit:checkReleaseManifest
:react-native-audio-toolkit:preDebugAndroidTestBuild UP-TO-DATE
:react-native-audio-toolkit:preDebugBuild UP-TO-DATE
:react-native-audio-toolkit:preDebugUnitTestBuild UP-TO-DATE
:react-native-audio-toolkit:preReleaseUnitTestBuild UP-TO-DATE
:react-native-audio-toolkit:prepareComAndroidSupportAppcompatV72301Library
:react-native-audio-toolkit:prepareComAndroidSupportSupportV42301Library
:react-native-audio-toolkit:prepareComFacebookFbuiTextlayoutbuilderTextlayoutbuilder100Library
:react-native-audio-toolkit:prepareComFacebookFrescoDrawee101Library
:react-native-audio-toolkit:prepareComFacebookFrescoFbcore101Library
:react-native-audio-toolkit:prepareComFacebookFrescoFresco101Library
:react-native-audio-toolkit:prepareComFacebookFrescoImagepipeline101Library
:react-native-audio-toolkit:prepareComFacebookFrescoImagepipelineBase101Library
:react-native-audio-toolkit:prepareComFacebookFrescoImagepipelineOkhttp3101Library
:react-native-audio-toolkit:prepareComFacebookReactReactNative0461Library
:react-native-audio-toolkit:prepareComFacebookSoloaderSoloader010Library
:react-native-audio-toolkit:prepareOrgWebkitAndroidJscR174650Library
:react-native-audio-toolkit:prepareReleaseDependencies
:react-native-audio-toolkit:compileReleaseAidl
:react-native-audio-toolkit:compileReleaseNdk UP-TO-DATE
:react-native-audio-toolkit:compileLint
:react-native-audio-toolkit:copyReleaseLint UP-TO-DATE
:react-native-audio-toolkit:compileReleaseRenderscript
:react-native-audio-toolkit:generateReleaseBuildConfig
:react-native-audio-toolkit:generateReleaseResValues
:react-native-audio-toolkit:generateReleaseResources
:react-native-audio-toolkit:mergeReleaseResources
:react-native-audio-toolkit:processReleaseManifest
:react-native-audio-toolkit:processReleaseResources
:react-native-audio-toolkit:generateReleaseSources
:react-native-audio-toolkit:incrementalReleaseJavaCompilationSafeguard
:react-native-audio-toolkit:compileReleaseJavaWithJavac
:react-native-audio-toolkit:compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
:react-native-audio-toolkit:extractReleaseAnnotations
:react-native-audio-toolkit:mergeReleaseShaders
:react-native-audio-toolkit:compileReleaseShaders
:react-native-audio-toolkit:generateReleaseAssets
:react-native-audio-toolkit:mergeReleaseAssets
:react-native-audio-toolkit:mergeReleaseProguardFiles
:react-native-audio-toolkit:packageReleaseRenderscript UP-TO-DATE
:react-native-audio-toolkit:packageReleaseResources
:react-native-audio-toolkit:processReleaseJavaRes UP-TO-DATE
:react-native-audio-toolkit:transformResourcesWithMergeJavaResForRelease
:react-native-audio-toolkit:transformClassesAndResourcesWithSyncLibJarsForRelease
:react-native-audio-toolkit:mergeReleaseJniLibFolders
:react-native-audio-toolkit:transformNative_libsWithMergeJniLibsForRelease
:react-native-audio-toolkit:transformNative_libsWithSyncJniLibsForRelease
:react-native-audio-toolkit:bundleRelease
:app:prepareComAndroidSupportAppcompatV72301Library
:app:prepareComAndroidSupportSupportV42301Library
:app:prepareComFacebookFbuiTextlayoutbuilderTextlayoutbuilder100Library
:app:prepareComFacebookFrescoDrawee101Library
:app:prepareComFacebookFrescoFbcore101Library
:app:prepareComFacebookFrescoFresco101Library
:app:prepareComFacebookFrescoImagepipeline101Library
:app:prepareComFacebookFrescoImagepipelineBase101Library
:app:prepareComFacebookFrescoImagepipelineOkhttp3101Library
:app:prepareComFacebookReactReactNative0461Library
:app:prepareComFacebookSoloaderSoloader010Library
:app:prepareOrgWebkitAndroidJscR174650Library
:app:prepareSoundTesterReactNativeAudioToolkitUnspecifiedLibrary
:app:prepareDebugDependencies
:app:compileDebugAidl
:app:compileDebugRenderscript
:app:generateDebugBuildConfig
:app:mergeDebugShaders
:app:compileDebugShaders
:app:generateDebugAssets
:app:mergeDebugAssets
:app:generateDebugResValues
:app:generateDebugResources
:app:mergeDebugResources
:app:bundleDebugJsAndAssets SKIPPED
:app:processDebugManifest
:app:processDebugResources
:app:generateDebugSources
:app:incrementalDebugJavaCompilationSafeguard
:app:compileDebugJavaWithJavac
:app:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources
:app:transformClassesWithDexForDebug
Running dex in-process requires build tools 23.0.2.
For faster builds update this project to use the latest build tools.
:app:mergeDebugJniLibFolders
:app:transformNative_libsWithMergeJniLibsForDebug
:app:processDebugJavaRes UP-TO-DATE
:app:transformResourcesWithMergeJavaResForDebug
:app:validateSigningDebug
:app:packageDebug
:app:assembleDebug
:app:installDebug
Installing APK 'app-debug.apk' on 'Moto G (4) - 7.0' for app:debug
Installed on 1 device.

BUILD SUCCESSFUL

Total time: 53.423 secs
Running /home/ashish/Android/Sdk/platform-tools/adb -s ZY2238GHF4 reverse tcp:8081 tcp:8081
Starting the app on ZY2238GHF4 (/home/ashish/Android/Sdk/platform-tools/adb -s ZY2238GHF4 shell am start -n com.soundtester/com.soundtester.MainActivity)...
Starting: Intent { cmp=com.soundtester/.MainActivity }

As it can be inferred from the logs, I was successfully able to build and run the app using RN 0.46.1

Android Installation: Configuration with name 'default' not found.

"react": "15.4.0",
"react-native": "0.41.2",
"react-native-audio-toolkit": "^1.0.5",

Getting this error when trying to install the plugin for Android per the instructions:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Cannot evaluate module react-native-audio-toolkit : Configuration with name 'default' not found.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

By the way, we should update the docs to tell the user to use react-native link react-native-audio-toolkit because it does all of these changes automatically for you for both iOS and Android.

Reïnitialise player

Is it possible to reïnitialise the player when an error has occured? Something like Player.refresh would be awesome!

Is there a way to change playback speeds?

It would be nice to have a feature that allows you to control the playback rate (e.g. play a file at twice the normal speed). Would anybody be able to help me out with this?

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.