Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-audio-streaming-player-enhanced

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-audio-streaming-player-enhanced

An audio streaming player for React Native

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8
Maintainers
1
Weekly downloads
 
Created
Source

react-native-streaming-audio-player npm version

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

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 (
      <View style={styles.container}>
        <View style={{ flexDirection: 'row', alignSelf: 'stretch', justifyContent: 'space-around' }}>
          <Button
            title='Play'
            onPress={() => this.onPlay()}
            color='red'
          />
          <Button
            title='Pause'
            onPress={() => this.onPause()}
            color='red'
          />
        </View>
      </View>
    );
  }
}

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
  • onUpdatePosition

PlaybackState

  • NONE
  • PLAYING
  • BUFFERING
  • PAUSED
  • STOPPED
  • COMPLETED

PlayerAction

  • 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

Keywords

FAQs

Package last updated on 07 Apr 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc