0.8.2 • Published 8 months ago

@lyl-radio/react-native-audio v0.8.2

Weekly downloads
-
License
MIT
Repository
-
Last release
8 months ago

react-native-audio

React Native audio library with background capabilities on both iOS and Android.

Installation

Install from the command line:

$ npm install @lyl-radio/react-native-audio@0.8.2

Install via package.json:

"@lyl-radio/react-native-audio": "0.8.2"

Usage

The Audio takes a Source object as input.

import Audio from "@lyl-radio/react-native-audio"

Audio.play({ uri: 'https://your/content.mp3' })

The Source includes metadata to setup the Now Playing Info on iOS' Control Center and the Media Controls on Android.

type Source = {
  uri: string
  title: string
  artwork?: string
  album?: string
  artist?: string
  albumArtist?: string
}

See example for more details.

Hooks

A simple set of hooks allows you to respond to player events.

usePlaybackState

The player state hook will return PlaybackState on change events allowing you to update your stateful function component when the player starts playing, buffering or on paused or ended.

usePlayerDuration

The player duration hook will update your function component when the player has updated the playing track duration in seconds.

usePlayerProgress

Updates your function component as the player progress. The progress value is expressed in seconds.

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

0.8.1

8 months ago

0.8.0

8 months ago

0.8.2

8 months ago

0.7.0

9 months ago

0.6.6

2 years ago

0.6.5

2 years ago

0.6.3

3 years ago

0.6.4

3 years ago

0.6.2

3 years ago

0.6.1

3 years ago

0.6.0

3 years ago

0.5.1

3 years ago

0.5.0

3 years ago