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

@5stones/react-native-track-player

v4.0.0-web.10

Published

A fully fledged audio module created for music apps

Downloads

60

Readme

downloads npm discord Commitizen friendly


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

Not sure where to start?

  1. Try Getting Started.
  2. Peruse the API Docs.
  3. Run the Example Project.

Commerical Usage

Are you using RNTP for a personal project? Great! Sponsor us if you're able but otherwise you can support us by reporting any bugs you find, sending us screenshots of your projects and starring us on Github 🌟

Are you using RNTP at your organisation and/or making money from it? Awesome! We rely on your support to keep RNTP developed and maintained under the Apache-2.0 license. You can do that through Github Sponsors.

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 lock screen, 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
  • 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

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 of 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 the foreground (such as sound effects, voice messages, etc.)

react-native-music-controls is meant for apps using those audio modules, but it has a few problems: the audio isn't tied directly 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 Setup

First please take a look at the Getting Started guide, but a basic example of how to play a track:

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

const start = async () => {
    // Set up the player
    await TrackPlayer.setupPlayer();

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

    // Start playing it
    await TrackPlayer.play();
};
start();

Core Team ✨

External Core Contributors ✨

Special Thanks ✨

Contributing

You want this package to be awesome and we want to deliver on that. As you know already you can just File A Ticket, but thats not actually the best way for you to get what you need (read on to see why). The best way is for you to Be A Champion and dive into the code.

File A Ticket

The reality is that filing a ticket isn't always enough. This is probably only going to work if your issue aligns with both the interests and the resources available to the core team. Here are the things that align with our interests in order of priority.

  1. Fixing widespread, common, and critical Bugs.
  2. Fixing uncommon but necessary Bugs.
  3. Introducing new Features that have broad value.

Now keep in mind available resources. Long story short, the thing you care about needs to be cared about by either a lot of other people, or by us.

BUT! There's another and, arguably even better way that helps you get what you need faster: Be A Champion.

Be A Champion

Being a champion makes it easy for us to help you. Which is what we all want! So how can you be a champion? Sponsor the Project or be willing to write some code.

If you're willing to write some code we're willing to:

  • Open a design discussion, give feedback, and approve something that works.
  • Provide guidance in the implementation journey.

So, in a nutshell, let us know you're willing to do the work and ask for a little guidance, and watch the things you care about get done faster than anyone else. The best help will be given to those who are willing to help themselves.

You don't have experience you say? It's OK!

You may be thinking that you can't help because you know nothing about native iOS or Android or maybe even React code. But we're willing to help guide you.

If you're up for that task then we can help you understand native code and how React Native works.

The only way you go from not-knowing to knowing is by learning. Learning isn't something you should be ashamed of nor is it something you should be scared of.

Where Do You Start?

Our goal is to make it as easy as possible for you to make changes to the library. All the documentation on how to work on the library and it's dependencies is located in this Guide

Release

The standard release command for this project is yarn version.

yarn version [--major | --minor | --patch | --new-version <version>]

Ex.

yarn version --new-version 1.2.17
yarn version --patch // 1.2.17 -> 1.2.18
yarn version --minor // 1.2.18 -> 1.3.0
yarn version --major // 2.0.0

This command will:

  1. Generate/update the Changelog
  2. Bump the package version
  3. Tag & pushing the commit
  4. Build & publish the package

Community

You can find us as part of the React Native Track Player:

  • #introduce-yourself - Come greet the newest members of this group!
  • #troubleshooting-forum - Ask members of the community to trouble shoot issues with your app and make recommendations.
  • #show-and-tell - Tell the community about the app you made with this project!
  • #news-and-releases - Stay updated about the latest releases and dev efforts on the project.

Web Notes

https://github.com/shaka-project/shaka-player/blob/7772099029acb47e6905a688f6cfc9c8738c6ff2/docs/tutorials/faq.md

Q: Why doesn't my HLS content work?

A: If your HLS content uses MPEG2-TS, you may need to enable transmuxing. The only browsers capable of playing TS natively are Edge and Chromecast. You will get a CONTENT_UNSUPPORTED_BY_BROWSER error on other browsers due to their lack of TS support.

You can enable transmuxing by including mux.js v5.6.3+ in your application. If Shaka Player detects that mux.js has been loaded, we will use it to transmux TS content into MP4 on-the-fly, so that the content can be played by the browser.