Skip to content
This repository was archived by the owner on Oct 6, 2022. It is now read-only.

Commit dddd195

Browse files
authored
change order of Sections in readme (#370)
Because it's necessary to call `.setNowPlaying()` for the controls to work, I've moved it before the `enableControl` section (which is not sufficient to "enable" the controls).
1 parent 82df264 commit dddd195

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

README.md

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,34 @@ See [TROUBLESHOOTING.md](./TROUBLESHOOTING.md)
5050
import MusicControl from 'react-native-music-control'
5151
```
5252

53+
### Now Playing
54+
55+
The `setNowPlaying` method enables the music controls. To disable them, use `resetNowPlaying()`.
56+
57+
You should call this method after a sound is playing.
58+
59+
For Android's rating system, remove the `rating` value for unrated tracks, use a boolean for RATING_HEART or RATING_THUMBS_UP_DOWN and use a number for other types.
60+
61+
**Note**: To use custom types, you have to define the type with `updatePlayback` before calling this function.
62+
63+
```javascript
64+
MusicControl.setNowPlaying({
65+
title: 'Billie Jean',
66+
artwork: 'https://i.imgur.com/e1cpwdo.png', // URL or RN's image require()
67+
artist: 'Michael Jackson',
68+
album: 'Thriller',
69+
genre: 'Post-disco, Rhythm and Blues, Funk, Dance-pop',
70+
duration: 294, // (Seconds)
71+
description: '', // Android Only
72+
color: 0xffffff, // Android Only - Notification Color
73+
colorized: true, // Android 8+ Only - Notification Color extracted from the artwork. Set to false to use the color property instead
74+
date: '1983-01-02T00:00:00Z', // Release Date (RFC 3339) - Android Only
75+
rating: 84, // Android Only (Boolean or Number depending on the type)
76+
notificationIcon: 'my_custom_icon', // Android Only (String), Android Drawable resource name for a custom notification icon
77+
isLiveStream: true, // iOS Only (Boolean), Show or hide Live Indicator instead of seekbar on lock screen for live streams. Default value is false.
78+
})
79+
```
80+
5381
### Enable and Disable controls
5482

5583
**iOS**: Lockscreen
@@ -94,34 +122,6 @@ For Android, 5, 10 and 30 is fixed
94122

95123
For iOS, it is dynamic so any number is accepted
96124

97-
### Now Playing
98-
99-
The `setNowPlaying` method enables the music controls. To disable them, use `resetNowPlaying()`.
100-
101-
You should call this method after a sound is playing.
102-
103-
For Android's rating system, remove the `rating` value for unrated tracks, use a boolean for RATING_HEART or RATING_THUMBS_UP_DOWN and use a number for other types.
104-
105-
**Note**: To use custom types, you have to define the type with `updatePlayback` before calling this function.
106-
107-
```javascript
108-
MusicControl.setNowPlaying({
109-
title: 'Billie Jean',
110-
artwork: 'https://i.imgur.com/e1cpwdo.png', // URL or RN's image require()
111-
artist: 'Michael Jackson',
112-
album: 'Thriller',
113-
genre: 'Post-disco, Rhythm and Blues, Funk, Dance-pop',
114-
duration: 294, // (Seconds)
115-
description: '', // Android Only
116-
color: 0xffffff, // Android Only - Notification Color
117-
colorized: true, // Android 8+ Only - Notification Color extracted from the artwork. Set to false to use the color property instead
118-
date: '1983-01-02T00:00:00Z', // Release Date (RFC 3339) - Android Only
119-
rating: 84, // Android Only (Boolean or Number depending on the type)
120-
notificationIcon: 'my_custom_icon', // Android Only (String), Android Drawable resource name for a custom notification icon
121-
isLiveStream: true, // iOS Only (Boolean), Show or hide Live Indicator instead of seekbar on lock screen for live streams. Default value is false.
122-
})
123-
```
124-
125125
### Update Playback
126126

127127
You don't need to set all properties when calling the `updatePlayback` method, but you should always set `elapsedTime` for iOS support and better performance on Android.

0 commit comments

Comments
 (0)