pwbrown/react-native-ios-network-audio

Event Listener

anthonyivol opened this issue · 0 comments

Hi,

I have encountered problems while trying to register listener on event, the example in the Readme doesn't work for me ( react 15.3.1 & react-native 0.33.0 ) : All I got was "Sendind 'AudioEnded' with no listener registred" in a YellowBox.

That's what I had to do ( es6 ) :

import { NativeModules, NativeEventEmitter } from 'react-native';

const audioEvent = new NativeEventEmitter(NativeModules.RNAudioPlayerURL);
audioEvent.addListener('AudioEnded', (trigger) => { console.log( trigger.event ) });

Maybe you should update the doc ( there is also a typo : NativeAppEventEmitter vs NativeAppEventEmmiter )