npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ks-react-native-track-player

v2.0.0-rc17

Published

A fully fledged audio module created for music apps

Downloads

7

Readme

npm Chat Spectrum

react-native-track-player

A fully fledged audio module created for music apps. Provides audio playback, external media controls, chromecast support, background mode and more!


Features

  • Lightweight - Optimized to use the least amount of resources according to your needs
  • Feels native - As everything is built together, it follows the same design principles as real music apps do
  • Multi-platform - Supports Android, iOS and Windows
  • Media Controls support - Provides events for controlling the app from a bluetooth device, the lockscreen, a notification, a smartwatch or even a car
  • Local or network, files or streams - It doesn't matter where the media belongs, we've got you covered
  • Casting support - Seamlessly switch to any Google Cast compatible device, supporting custom media receivers
  • Adaptive bitrate streaming support - Support for DASH, HLS or SmoothStreaming
  • Caching support - Cache media files to play them again without an internet connection
  • Background support - Keep playing audio even after the app is in background
  • Fully Customizable - Even the notification icons are customizable!
  • Supports React Hooks 🎣 - Includes React Hooks for common use-cases so you don't have to write them

Platform Support

| Feature | Android | iOS | Windows | | ------- | :-----: | :-: | :-----: | | Load from the app bundle | ✓ | ✓ | ✓ | | Load from the network | ✓ | ✓ | ✓ | | Load from the file system | ✓ | ✓ | ✓ | | Adaptive Bitrate Streaming | ✓ | ✗ | ✓ | | Play/Pause/Stop/Reset | ✓ | ✓ | ✓ | | Seeking/Volume | ✓ | ✓ | ✓ | | Remote Media Controls | ✓ | ✓ | ✓ | | Caching | ✓ | ✗ | ✗ | | Events | ✓ | ✓ | ✓ | | Background Mode | ✓ | ✓ | ✓ | | Casting | ✓ | ✗ | ✗ |

Check Platform Support for more information.

Why another music module?

After trying to team up modules like react-native-sound, react-native-music-controls and react-native-google-cast, I've noticed that their structure and the way should be tied together can cause a lot problems (mainly on Android). Those can heavily affect the app stability and user experience.

All audio modules (like react-native-sound) don't play in a separated service on Android, which should only be used for simple audio tracks in foreground (such as sound effects, voice messages, etc)

react-native-music-controls is meant for apps using those audio modules, although it has a few problems due to how the audio is not directly tied to the controls, it can be pretty useful for casting (such as Chromecast)

react-native-google-cast works pretty well and also supports custom receivers, but it has fewer player controls, it's harder to integrate and still uses the Cast SDK v2

Example

If you want to get started with this module, check the API page. If you want detailed information about the API, check the Documentation. You can also look at our example project here.

import TrackPlayer from 'react-native-track-player';

// Creates the player
TrackPlayer.setupPlayer().then(async () => {

    // Adds a track to the queue
    await TrackPlayer.add({
        id: 'trackId',
        url: require('track.mp3'),
        title: 'Track Title',
        artist: 'Track Artist',
        artwork: require('track.png')
    });

    // Starts playing it
    TrackPlayer.play();

});

Maintainers

David Chavez & Guilherme Chaguri

Support the development

Support the further development of this and other libraries.