GithubHelp home page GithubHelp logo

hhy5277 / react-native-track-player Goto Github PK

View Code? Open in Web Editor NEW

This project forked from doublesymmetry/react-native-track-player

0.0 1.0 0.0 3.41 MB

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

License: Apache License 2.0

Java 48.39% JavaScript 11.20% Objective-C 3.60% Swift 15.50% Ruby 0.38% C# 20.93%

react-native-track-player's Introduction

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!

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.

react-native-track-player's People

Contributors

ananevam avatar anderslemke avatar biomancer avatar callmetwan avatar curiousdustin avatar dcvz avatar dnish avatar egorkhmelev avatar frenkie avatar gazedash avatar guichaguri avatar ithustle avatar lihop avatar meninblack007 avatar moduval avatar olivierlesnicki avatar peterlazar1993 avatar puckey avatar roelvb avatar rtmalone avatar sirajulm avatar thessler27 avatar timmywil avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.