Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kyo504/react-native-audio-streaming-player
An audio steaming player for React Native
https://github.com/kyo504/react-native-audio-streaming-player
android audio-player ios react-native streaming-audio
Last synced: 3 months ago
JSON representation
An audio steaming player for React Native
- Host: GitHub
- URL: https://github.com/kyo504/react-native-audio-streaming-player
- Owner: kyo504
- License: mit
- Created: 2018-02-16T09:20:21.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2021-09-21T02:06:21.000Z (over 3 years ago)
- Last Synced: 2024-08-11T11:17:28.993Z (6 months ago)
- Topics: android, audio-player, ios, react-native, streaming-audio
- Language: Java
- Homepage:
- Size: 695 KB
- Stars: 42
- Watchers: 5
- Forks: 20
- Open Issues: 31
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# react-native-streaming-audio-player [![npm version](https://badge.fury.io/js/react-native-streaming-audio-player.svg)](https://badge.fury.io/js/react-native-streaming-audio-player)
Streaming audio player for iOS + Android
# Features
- Play remote streaming audio source
- Handle audio focus for...
- incoming and outgoing calls
- switching application contexts
- Control audio from notification and lock screen (**Android**)
- Control audio from control center and lock screen (**iOS**)
- Control audio from headsets# Installation
First, install the library from npm:```
npm install react-native-streaming-audio-player --save
```Second, link the native dependencies.
```
react-native link react-native-streaming-audio-player
```# Running a sample app
In the Example directory:
```
cd Examples
npm install
react-native run-ios or run-android
```# Usage
```javascript
import Player from 'react-native-streaming-audio-player';export default class Example extends Component {
constructor(props) {
super(props);
this.state = { currentTime: 0 }
this.onUpdatePosition = this.onUpdatePosition.bind(this);
}onPlay() {
Player.play(source.url, {
title: source,
artist: source.artist,
album_art_uri: source.arworkUrl,
});
}onPause() {
Player.pause();
}render() {
return (
this.onPlay()}
color='red'
/>
this.onPause()}
color='red'
/>
);
}
}const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
});
```# API and Configuration
Player Control
- play(url: string, metadata: object)
- metadata.title
- metadata.artist
- metadata.album_art_uri
- pause()
- stop()Callbacks
- onPlaybackStateChanged
- onUpdatePositionPlaybackState
- NONE
- PLAYING
- BUFFERING
- PAUSED
- STOPPED
- COMPLETEDPlayerAction
- Play
- Pause
- SkipToNext
- SkipToPrevious# Roadmap
- [ ] Unit tests
- [ ] Clean up# Contribute
# License
This project is licensed under the MIT License - see the LICENSE file for details