4.1.1 • Published 2 days ago

react-native-track-player v4.1.1

Weekly downloads
10,336
License
Apache-2.0
Repository
github
Last release
2 days ago

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

FeatureAndroidiOSWindows
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.

4.1.1

2 days ago

4.1.0

3 days ago

4.0.1

5 months ago

4.0.0

5 months ago

4.0.0-rc09

6 months ago

4.0.0-rc05

9 months ago

4.0.0-rc07

8 months ago

4.0.0-rc06

8 months ago

4.0.0-rc08

7 months ago

4.0.0-rc03

1 year ago

4.0.0-rc02

1 year ago

4.0.0-rc04

12 months ago

4.0.0-rc01

1 year ago

3.2.0

2 years ago

3.1.0

2 years ago

2.2.0-rc4

2 years ago

3.0.0

2 years ago

2.1.4

2 years ago

2.1.3

2 years ago

2.2.0-rc3

2 years ago

2.2.0-beta10

2 years ago

2.2.0-beta11

2 years ago

2.2.0-beta12

2 years ago

2.2.0-beta13

2 years ago

2.2.0-beta14

2 years ago

2.2.0-rc1

2 years ago

2.2.0-rc2

2 years ago

2.2.0-beta9

2 years ago

2.2.0-beta8

2 years ago

2.2.0-beta7

2 years ago

2.2.0-beta6

2 years ago

2.1.2

2 years ago

2.2.0-beta2

2 years ago

2.2.0-beta1

2 years ago

2.2.0-beta4

2 years ago

2.2.0-beta3

2 years ago

2.2.0-beta5

2 years ago

2.1.1

3 years ago

2.1.0

3 years ago

2.0.3

3 years ago

2.0.2

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

2.0.0-rc18

3 years ago

2.0.0-rc17

3 years ago

2.0.0-rc16

3 years ago

2.0.0-rc15

3 years ago

2.0.0-rc14

3 years ago

1.2.7

3 years ago

1.2.6

3 years ago

1.2.5

3 years ago

1.2.4

3 years ago

1.2.3

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.1.8

5 years ago

1.1.7

5 years ago

2.0.0-rc13

5 years ago

2.0.0-rc12

5 years ago

2.0.0-rc11

5 years ago

2.0.0-rc10

5 years ago

2.0.0-rc9

5 years ago

2.0.0-rc8

5 years ago

2.0.0-rc7

5 years ago

2.0.0-rc6

5 years ago

2.0.0-rc5

5 years ago

2.0.0-rc4

5 years ago

2.0.0-rc3

5 years ago

2.0.0-rc2

5 years ago

2.0.0-rc1

5 years ago

1.1.6

5 years ago

1.2.0

5 years ago

1.1.6-rc1

5 years ago

1.1.5

5 years ago

1.1.5-rc11

5 years ago

1.1.5-rc10

5 years ago

1.1.5-rc9

5 years ago

1.1.5-rc8

5 years ago

1.1.5-rc7

5 years ago

1.1.5-rc6

5 years ago

1.1.5-rc5

5 years ago

1.1.5-rc4

5 years ago

1.1.5-rc3

5 years ago

1.1.5-rc2

5 years ago

1.1.5-rc1

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.2.5

6 years ago

0.2.4

6 years ago

0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago

0.0.2

7 years ago

0.0.1

7 years ago