react-native-radio-player
TypeScript icon, indicating that this package has built-in type declarations

0.3.1 • Public • Published

react-native-radio-player

FOSSA Status

Play radio streams in react-native

Installation

yarn install react-native-radio-player

Usage

import RadioPlayer, {
  RadioPlayerEvents,
  RadioPlayerMetadata,
} from 'react-native-radio-player';

// ...

const metadataSeparator = "-"; // Used to split artist and title in stream metadata
RadioPlayer.radioURLWithMetadataSeparator('https://...', metadataSeparator);
// or RadioPlayer.radioURL('https://...')
RadioPlayer.stop();
RadioPlayer.play();

// State: error, stopped, playing, paused, buffering
RadioPlayerEvents.addEventListener('stateDidChange', (event) => {
  console.log(event.state);
});
// Metadata: {"artistName": "Example Artist", "trackName": "Example Title"}
RadioPlayerEvents.addListener('MetadataDidChange', (metadata) => {
  console.log(`Artist: ${metadata.artistName}`);
  console.log(`Title: ${metadata.trackName}`);
});

Contributing

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

License

MIT

FOSSA Status Made with create-react-native-library

Dependencies (0)

    Dev Dependencies (21)

    Package Sidebar

    Install

    npm i react-native-radio-player

    Weekly Downloads

    23

    Version

    0.3.1

    License

    MIT

    Unpacked Size

    46 kB

    Total Files

    25

    Last publish

    Collaborators

    • dehy