import { ReactNativeStreamingPlayer } from 'egm0121-react-native-audio-streaming';
const player = new ReactNativeStreamingPlayer();
player.setSoundUrl("http://mydemowebsite.com/stream.mp3");
player.play();
player.pause();
player.resume();
player.getStatus((err,data) => {
let progress = parseFloat(data.progress);
let duration = parseFloat(data.duration);
});
player.on('stateChange',(evt) => {});
player.on('RemoteControlEvents',(evt) => {});
player.on('AudioRouteInterruptionEvent',(evt) => {});
player.destroy();$ npm install react-native-audio-streaming --save
$ react-native link react-native-audio-streaming
Go to node_modules ➜ react-native-audio-streaming => ios and add Pods.xcodeproj
In XCode, in the project navigator, select your project. Add libReactNativeAudioStreaming.a and libStreamingKit.a to your project's Build Phases ➜ Link Binary With Libraries
- In XCode, in the project navigator, right click
Libraries➜Add Files to [your project's name] - Go to
node_modules➜react-native-audio-streaming=>ios- run
pod installto download StreamingKit dependency - add
ReactNativeAudioStreaming.xcodeproj - add
Pods/Pods.xcodeproj
- run
- In XCode, in the project navigator, select your project. Add
libReactNativeAudioStreaming.aandlibStreamingKit.ato your project'sBuild Phases➜Link Binary With Libraries - Run your project (
Cmd+R)
- iOS version based on the work of @tlenclos https://github.com/tlenclos/react-native-audio-streaming