Permissions
Widgets declare the capabilities they need in the permissions array of
manifest.json. Request only what you use — actions whose permission
you haven’t declared simply do nothing.
"permissions": ["artwork", "playbackControl"]
Available permissions
| Permission | Grants |
|---|---|
artwork | Access to album artwork via getArtworkDataURL() and track.artworkData. |
playbackControl | playPause(), next(), previous(). |
volumeControl | increaseVolume(), decreaseVolume(), toggleMute(), setVolume(). |
love | toggleLove() and toggleDislike() (Apple Music). |
ratingControl | Star ratings: setRating(), increaseRating(), decreaseRating(), removeRating() (Apple Music only). |
shuffleRepeatControl | toggleShuffle(), toggleRepeat(). |
playerActivation | activatePlayer(), switchPlayer(). |
Capabilities vs. permissions
Permissions are what your widget asks for. Capabilities are what the current
player supports — read them from
NepTunes.capabilities. For example, Spotify
doesn’t expose star ratings, so capabilities.canRate is false even if you hold the
ratingControl permission. Check capabilities before showing controls that the active
player can’t fulfil:
if (NepTunes.capabilities.canLove) {
loveButton.hidden = false;
}