Spintunes extension (for Spotify)
Hi,
in January, I had written a Karoo extension that provides a data field with media controls for Spotify. Spotify has now greenlit this extension and it is available for sideloading here: https://github.com/timklge/karoo-spintunes :-)


There are two ways to use it:
- Remote control mode: You can install this extension on your Karoo, log in to Spotify and control Spotify running on your phone (or any other "Spotify Connect"-enabled device like your computer if you are training indoors). The extension will control the Spotify app via the Spotify Web API, so you need an active internet connection (which is provided by the companion app as long as your phone has mobile data reception). Unfortunately, volume control is not available in this mode when controlling the Spotify app on Android or iOS because the Web API doesn't support it. Player state is refreshed every 45 seconds and when the current song ends. I have used this during many rides now and think it works well, even though any action goes from the Karoo through your phone to the Spotify servers and back to your phone. Actions can take up to a few seconds to take effect though, as the companion app bluetooth bridge is not really designed for interactive usage like this
- Standalone mode: If you have sideloaded Spotify itself onto your Karoo, the extension can be used to directly control the Spotify app, which works without an internet connection. You can then directly pair your bluetooth headphones to the Karoo and thereby also get the radar alerts, TBT sounds etc the Karoo can play over bluetooth. Please note that the Spotify app can not use the companion app to stream new songs while riding, so you have to download the playlists you want to listen to using the Spotify app itself and let it synchronize them while you are within WiFi range. Player state is refreshed instantly in this mode and there is no delay with actions because everything works local.
So this works very differently than how media control works on Garmin and Wahoo devices. There, the companion app controls the media app running on your phone. A karoo extension can not do this because it requires running code on the phone, so you would need a separate companion app for both iOS and Android and get it distributed via respective app stores and I think that's just too much work for too little value. The proprietary Spotify API is a nice way around it. On the plus side, the extension can do Spotify-specific stuff like changing to a different playlist or podcast during riding, queueing songs etc. which can not be done with generic media control.
The extension will ask for access to your Spotify playlists etc. so that it can show a list of them and start playing them when you ask it to. The extension talks directly to the Spotify servers. It is open-source, so you can check the code on Github yourself (or decompile it if you don't trust the release build).
If you try it, please leave some feedback if it works for you or if you have issues with it. It required much more effort to get this extension done than I had thought, mainly because of the Spotify review, which took several months and I had to submit it twice because it didn't meet the review criteria on first try. Still was a fun project though. Unfortunately, Spotify has recently changed their review criteria, and will only approve apps with more than 250K active users and made by professional companies in the future, so new hobby projects like this extension will not be approved anymore.
Currently, the extension while only work on Karoo 3 devices. It doesn't work on the Karoo 2 because the browser installed on the K2 is too old to render the Spotify login web page, which is needed to log in. Thanks to @plassani on Github for telling me.
-
How can I operate Spintunes in Standalone mode.
I am only able to operate SpinTunes in preview window. But when changing to proviles->datafield->SpinTunes and then try to control spotify via the buttons a http 404 request was started it took seconds to return with all fields grayed out.
I have to state that I have downloaded the spotify app called "spotify lite" and added locally a playlist also.
With spotify lite I am capable to play and download playlists.
It seems my installation does not connect to "spotify lite". Right?
What is wrong on my side
Thanks
-
Hi,
I wasn't aware that there is a "Lite" version of the Spotify app; it isn't available in my country via the play store. I've tested it on my device now, but unfortunately, it doesn't support the spotify app remote of the Spotify Android SDK that the spintunes app uses to control the local spotify app if it is installed on the Karoo.
So to use the "standalone" / local mode with spotify installed on the Karoo, you'll have to use the main spotify app if you want to use the extension, sorry. You can also use the extension as a remote control to control Spotify / Spotify Lite running on your phone; Spotify Lite does support the Spotify web api which the extension can use to remote control Spotify if the app is running on your phone, it just doesn't support the android api.
-
I've pushed an update to version 1.0.
The extension will now only refresh the player state when it is on screen instead of every 45 seconds to save battery. Because a refresh can take up to a few seconds via the companion app bluetooth bridge, this can introduce a delay when switching to the data page with the player data field before it is updated. You can restore the old behavior in the app settings.
-
I've pushed an update to version 1.0.1. It rearranges the seek buttons to have the play button in the middle:

Also, the player data field will now show error descriptions instead of just displaying "Unknown" if it fails to retrieve the current player state.
Full Changelog: https://github.com/timklge/karoo-spintunes/releases/tag/1.0.1
-
@NewK Unfortunately right now, it doesn't work on the K2 for the sole reason that the browser on the K2 is too old to render the Spotify Login page. I hope Hammerhead updates the browser in a future software update, I've sent them an email about it (the current version is from 2017). You could sideload firefox and set is as the default browser; it can render the spotify login just fine, but it's a bit cumbersome to install it just to pass the login. Check this issue on github: https://github.com/timklge/karoo-spintunes/issues/53#issuecomment-3176034864
-
Hi I would like to use spintunes as a datafield in my profile.
However after selection of the datafield I have two problems:
1) cannot connect to api.spotify.com
and
2) it seems when I am not connected to internet all elements are greyed out so unselectable.
But I would like to play downloaded charts..
What can I do?
Thanks Anbreas
-
@Andreas: Unfortunately, the extension needs constant internet access to control the spotify app on your phone; It directly talks to the spotify servers, which in turn tell the spotify app running on your phone to change tracks etc. I had to implement it this way because the extension has no idea what is going on on your phone; I would have needed to write a separate companion app for that and get it published on the play store / ios app store. However, if you use a Karoo 3 and have the companion app installed on your phone and have mobile reception, it should work fine as the karoo companion app provides internet access. I use it like this on every ride.
The only way to get offline controls with the extension is by sideloading Spotify itself on the Karoo. I have written about it in the README file on github ("Standalone mode"): https://github.com/timklge/karoo-spintunes?tab=readme-ov-file#installation
To get proper media controls for any app and with offline capabilities, Hammerhead will need to implement it themselves natively, and add it to the existing companion app (in the same way that it works on Garmin and Wahoo devices).
-
Thanks for sharing all the details about Spintunes it’s an impressive project, honestly. I’ve been trying to use it in Standalone mode, but I’m running into some trouble getting it to work properly. I can open SpinTunes in the preview window, but once I switch to Profiles > Datafield > SpinTunes and try to control Spotify, it just hangs for a few seconds and the fields turn gray. I’m not sure if I’m missing something in the setup, but it doesn’t seem to respond the way it should. if you want to get spotify free of cost then download from https://spotipremiums.com/
-
If you want to control the local Spotify via Spintunes you have to start Spotify while you are connected to a Wlan with internet connection before every ride. If you want to browse your Spotify libary via Spintunes you have to open Spintunes (again while you have a Internet connection) once and load your libary. But you only have to do this once or once in a while.
-
Actually, it does work on Karoo 2 also, but you need to add an additional login method to your Spotify account (e.g., Google) and use it to log in on Karoo 2.
Please sign in to leave a comment.
Comments
12 comments