0.0.9 • Published 8 years ago

react-native-ios-network-audio v0.0.9

Weekly downloads
2
License
-
Repository
github
Last release
8 years ago

react-native-ios-network-audio

IOS class to add react-native implementation for web audio urls(look at AVPlayer documentation for audio compatibility). Tested using mp3 urls.

Add it to your project

Basic usage

//To initialize the audio clip
audio.initWithURL("http://your_audio_url_here");

//To retrieve the length of the clip in seconds as a float
audio.getDuration((duration) => {
	//do what you need with duration variable
	//***Example
	var minutes = Math.floor(duration/60);
	var seconds = Math.ceil((duration/60 - minutes) * 60);
	this.setState({minutes: minutes, seconds: seconds, totalSeconds: duration});
});

//To play audio clip
audio.play();

//To pause audio clip
audio.pause();

New Additions

//Listen for audio end
var {NativeAppEventEmmiter} = require('react-native');
var subscription = NativeAppEventEmitter.addListener(
	'AudioEnded',
	(trigger) => {console.log(trigger.event)};
);

//To seek to a specific time in seconds
audio.seekToTime(time_in_seconds);
0.0.9

8 years ago

0.0.8

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago