gst-plugins-rs/audio/spotify
Guillaume Desmottes ce7d314349 spotify: make common module public
Karapulse implements its own bin wrapping spotifyaudiosrc,
spotifylyricssrc and videotestsrc for rendering Spotify songs.

This element has lived in my own gst-plugins-rs branch for ages but now
that spotifylyricssrc has been usptreamed I'd like to move it to the
Karapulse source tree.
But to be able to do so it needs to be able to use the common module
from the spotify plugin.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1907>
2024-11-02 16:14:08 +01:00
..
src spotify: make common module public 2024-11-02 16:14:08 +01:00
build.rs add spotify plugin 2021-12-29 16:48:20 +01:00
Cargo.toml spotify: bump librespot dep to 0.6 2024-11-01 15:12:46 +01:00
LICENSE-MPL-2.0 git: replace LICENSE file symlinks with copies 2023-04-04 14:26:37 +01:00
README.md spotify: README: add https://open.spotify.com/get_access_token 2024-10-24 18:12:41 +02:00

gst-plugins-spotify

This is a GStreamer plugin to read content from Spotify.

Make sure that your application follows Spotify's design guidelines to respect their legal/licensing restrictions.

Spotify Credentials

This plugin requires a Spotify Premium account.

Provide a Spotify access token with 'streaming' scope using the access-token property. Such a token can be obtained by using either:

cargo install librespot-oauth --example oauth && oauth

Note, Spotify access tokens are only valid for 1 hour and must be refreshed for usage beyond that.

It is therefore advisable to also use the cache-credentials property. On first usage, your access token is exchanged for a reusable credentials blob and stored at the location specified by this property. Once obtained, that credentials blob is used for login and any provided access-token is ignored. Unlike Spotify access tokens, the user's credentials blob does not expire. Avoiding handling token refresh greatly simplifies plugin usage. If you do not set cache-credentials, you must manage refreshing your Spotify access token so it's valid for login when the element starts.

You may also want to cache downloaded files, see the cache-files property.

spotifyaudiosrc

The spotifyaudiosrc element can be used to play a song from Spotify using its Spotify URI.

gst-launch-1.0 spotifyaudiosrc access-token=$ACCESS_TOKEN track=spotify:track:3i3P1mGpV9eRlfKccjDjwi ! oggdemux ! vorbisdec ! audioconvert ! autoaudiosink

The element also implements an URI handler which accepts credentials and cache settings as URI parameters:

gst-launch-1.0 playbin3 uri=spotify:track:3i3P1mGpV9eRlfKccjDjwi?access-token=$ACCESS_TOKEN\&cache-credentials=cache\&cache-files=cache

spotifylyricssrc

The spotifylyricssrc element can be used to retrieve the lyrics of a song from Spotify.

gst-launch-1.0 spotifylyricssrc access-token=$ACCESS_TOKEN track=spotify:track:3yMFBuIdPBdJkkzaPBDjKY ! txt. videotestsrc pattern=black ! video/x-raw,width=1920,height=1080 ! textoverlay name=txt shaded-background=yes valignment=center halignment=center ! autovideosink