
How is Javascript used within the Spotify desktop application? - gflandre
http://www.quora.com/How-is-Javascript-used-within-the-Spotify-desktop-application/answer/Mattias-Petter-Johansson?share=1
======
LMAlVvQjSGj
The Spotify desktop client has seen a massive regression since 2008 or 2009.
It's incredible how they managed to make it so unresponsive. Scrolling in a
playlist is like playing a game at 10 fps. It's uncomfortable and not worth
it. Ads are worse as well. I've seen countless malware ads in the bottom
banner.

~~~
AustinScript
Hmm - I haven't really noticed any unresponsive-ness but I also am a paid
subscriber, I wonder if the ads are responsible for the slowness?

The spotify mobile app has some odd behavior from time to time. The UI will
continue to respond to my actions but nothing actually happens for 20 seconds,
during that time i'll click on several different songs attempting to get them
to play.

Finally, for whatever reason, the app springs back to life an begins to
execute the actions out of some sort of queue leading to several songs
playing. It seemed very odd to queue song plays in such manner. I would've
assumed it would be last one wins rather than "Song 1" \- play for 2 seconds
"Song 2" \- Play for 2 seconds "Song 3" \- play for 2 seconds

I may have clicked "Play song 2" 15 seconds ago before the song is actually
played.

Overall, I love spotify though. I use it everywhere.

~~~
seanp2k2
Spotify and SoundCloud are testaments to how users will endure whatever awful
UX you give them as long as they're getting enough value from your thing.

~~~
colordrops
The soundcloud mobile app is not that bad, at least on Android. It has the
best audio scrubbing of any app I've used. The UI is super simple and made to
work at a distance, e.g. while mounted in a card holder.

~~~
DanFeldman
I absolutely hate the soundcloud app compared to the spotify app. Constant
crashing, locks my phone up, random pauses during playback. Android, Samsung
Galaxy S4. The UI is fine I just wish it didn't break every other song.

------
miken123
Nice technical read, but to be honest, the moment I find another app that does
what I need I will gladly leave Spotify behind. Apart from the general
slugginess of the app, the number of features that have been removed over the
last couple of months is staggering. Just some examples, in case someone from
Spotify in a position to fix this is reading this:

* Searching in playlists was removed

* Searching in local files was removed (and the local file support has always been crap anyway, please work together with Last.fm to properly match files)

* Creating a new playlist in a folder was removed (you now have to create and move the playlist)

* Sorting playlist folders was removed.

* The option to turn off your 'volume normalisation' was removed. Because your algorithm is really broken and severely compresses the music, removing any dynamic range, this is the biggest showstopper for me. Check your forums, tens if not hundreds of people already left because of this.

* Apps were removed (tbh, I can live with this)

Oh, another one, please give us an option to turn off 'Spotify Connect'. It
prevents my Android phone from entering deep sleep, and thus it is a battery
drain. You don't need to fix the battery drainage, just give me an option to
turn the feature off.

~~~
MrBuddyCasino
Yes its a shit-show. They even had a (hidden) working equalizer in the OSX
version, but decided that this too was a feature that should be removed.

I still have no idea how to find a specific album in an artist's page, but of
course that is a minor concern, compared to their ability to "to work with
whatever frameworks they need, without the need to coordinate tooling and
dependencies with other squads".

The one thing Apple got right is to always optimize for user experience, never
for engineering convenience. Native code, no garbage collection - still pays
off today.

What would be a good cross-platform tech stack that satisfies those needs, and
isn't C++? Anything with a QT binding I suppose?

~~~
sorenjan
Python with Qt on top of C++ would probably be my choice, if pure C++ isn't an
option.

------
DigitalSea
I really like the approach that Spotify take to working on new features, the
squads idea is quite good. I think it is important that people occasionally
break out of their cliques and work with new people, I have found based on
personal experience that working with the same people day-in-day-out will
eventually give you tunnel vision. You stop learning from those around you,
eventually the hive-mind becomes one and there is little free-thinking.
Breaking out and working with another squad I think could be beneficial to
Spotify.

This is where the praise ends. As a Spotify Premium user, I love the service,
but the interface as many others have pointed out has really gone downhill. I
don't know who is leading the UX squad over at Spotify, but the app needs
considerable work. High startup times, incredible amounts of frame rate lag
and removal of the system tray icon. What is going on over there? I have also
noticed that the app can play a song quickly, but browsing and searching is
incredibly slow (even on a fast connection).

------
josteink
I'm not going to applaud Spotify for the direction their desktop-client has
taken UX-wise, but I did find this an interesting read about how they organize
both their code and teams.

I always assumed parts of the Spotify-client had to be HTML/JS based, but I
had no idea it was done to such an extensive degree.

------
not_kurt_godel
> I would bet that the Spotify desktop client is among the top 25 most
> intricate uses of JavaScript in the world.

If this is really true, "intricate" probably means "needlessly complex"
because the interface, while by no means bad, is nowhere near as sophisticated
as many JS apps I have seen and worked on. Off the top of my head, I would be
willing to bet GMail, Google Spreadsheets, and Facebook are all vastly more
"intricate" than the Spotify client based purely on number of features.

------
GeorgeHahn
While I'm appalled by some of the recent changes Spotify has made, I'm really
impressed by how easy it is to work on their desktop client. I can't even
imagine how nice things must be when you have the real source, automatic live-
reload, and don't have to muck around with concatenated or minified
JS/css/handlebars files. This setup can't be good for memory usage, but it
rocks for development!

For anyone who's curious, it's easy to take a look under the hood from the
Spotify installation folder. (Windows users can find it at %APPDATA%/Spotify/)

The Apps directory is full of *.spa files. These are zip files; if you extract
them to folders with the same names and delete the zips, the application will
still work, but you'll be able to edit the code.

The zlink directory is the most useful. This holds the main UI and much of the
logic that powers it. Search through main.js in this directory for the
Session.prototype.isDeveloper declaration. If you force it to return true, the
Spotify UI will refresh when you press F5 inside it. Now you don't have to
close and reopen every time you make a change! This will also add some
miscellaneous UI embellishments (they aren't terribly useful and can be
disabled by hardwiring logic elsewhere in main.js).

Initially, I thought the about directory would be a handy sandbox to mess
around in, but then I realized that you can easily add new apps! Integrating
them into the UI takes a bit of effort, but you can easily get to them by
putting the app URI into the search bar (spotify:app:___). (Each app's URI is
defined within the its js file. Make sure you give it a unique name in its
manifest, too.)

Additionally, you can open cef.pak and devtools_resources.pak with a text
editor and mess around (though they're not terribly useful).

NB: If you're really motivated, it shouldn't be too hard to set up a complete
development environment for this. I was able to quickly dump most of the
concatenated files to zips - all I needed to do to finish was to cut off some
of the module wrapper code and reformat directory paths. I quit when I
accomplished my goals of shuffling the UI around, but if you're interested, I
have a simple concatenated files dumper at
[https://gist.github.com/GeorgeHahn/0deef2fb0d392ef507dd](https://gist.github.com/GeorgeHahn/0deef2fb0d392ef507dd).

It takes a bit of mucking around, but it's not too hard to achieve a legacy-UI
feel (volume on the left, no lyrics button, de-uglified media control buttons,
compact playlist/track lists, etc). Of course, this will get ruined the next
time Spotify updates, so you should block updates and make backups if you want
to keep your changes.

~~~
touristtam
Maybe that could offer the basis for an alternative client. Thanks for sharing
your knowledge. :)

~~~
mwcampbell
An alternative desktop client using libspotify and a non-web GUI toolkit would
be much more interesting.

~~~
GeorgeHahn
Very true. There are a few options in that space: Clementine
([https://www.clementine-player.org/](https://www.clementine-player.org/)),
Tomahawk ([https://www.tomahawk-player.org/](https://www.tomahawk-
player.org/)), Mopidy ([https://www.mopidy.com/](https://www.mopidy.com/)),
Fidelify ([http://fidelify.net/](http://fidelify.net/), not OSS), Soundbounce
([http://soundbounce.org/](http://soundbounce.org/)). (Raise a glass to SOVND,
my personal project that I killed when I got fed up with libspotify.)

~~~
touristtam
Tried the first two: they are pretty poor music player as it is in my opinion.
The rest seems to be much more that a Spotify client.

------
matthewmacleod
It's been like this for some time – I remember I was able to inspect elements
within the page some time ago.

One of the problems though – the user experience of the app is rather
unpleasant. It's extremely laggy and noticeably non-native – using incorrect
keyboard shortcuts, and so on.

I'm sure it's possible to do it better, but the UX of the app used to be great
and is slowly declining, which is a real shame.

------
ly
I got a HDPI display for my windows machine a few days ago. What I am
wondering now is why Spotify doesn't support this? If it runs on chromium,
which does support hdpi displays, why doesn't spotify? I have I have to choose
for a really small spotify client or a real blurry one. Reading this, it would
not seem to hard to make it work. It works fine on OSX.

~~~
bbrks
I can't speak for Windows, but HiDPI Spotify works great on OS X.

[http://i.imgur.com/8mGbvnV.png](http://i.imgur.com/8mGbvnV.png)

~~~
ly
I know, I use it on OSX too, so thats why I was wondering why it doesn't work
on windows? It seems to be built on the same system.

------
odiroot
I have a feeling that's not the case for the Linux version. It looks
completely different than other platforms and is also build against Qt
libraries.

~~~
strangecasts
Yeah, the 32-bit Linux version (the 64-bit version has the new UI IIRC) is the
way the Spotify client used to look before they switched over to WebKit. I
wish it was possible to go back to that on Windows - it was much snappier and
didn't have lots of pointless padding between song titles.

------
jonnynezbo
First off, great Quora answer. I wonder: if the 'notifications' squad comes up
with an idea like 'users should be able to disable notifications', do they
have to collaborate with the 'settings' squad?

~~~
janpieterz
There are two [1] [2] super interesting videos about how Spotify works. Well
worth the watch!

[1] [https://vimeo.com/85490944](https://vimeo.com/85490944)

[2] [https://vimeo.com/94950270](https://vimeo.com/94950270)

------
est
Is Ludvig Strigeus @ludde (of µTorrent/OpenTTD/ScummVM fame) still developing
Spotify desktop client?

I hope this chromium crap isn't his decision.

~~~
johanbrook
He's still there, and is doing low level stuff and hacks in Gothenburg. I
heard he wrote much of the initial, highly optimized code for Spotify Connect.

I don't think the move from the C/C++ client was something he liked, tbh :)

------
thecopy
I am using Spotify 0.9.17 on Linux, and it is blazing fast. Starts up and is
ready in under 0.5 seconds. Compared to the new "improved" JS version on my OS
X it is an order of magnitude better.

I can still search in playlists! And i get the Top Lists for all the contries
instead of just a few (Spotify decimated the avaiable contries in top lists in
the JS version).

Stay on the native app as long as you can.

------
clemsen
Anybody who spent some time on
[https://community.spotify.com](https://community.spotify.com) will agree that
Spotify does not give a damn about the opinions of their most passionate users
(the ones that actually want to improve the experience by participating in the
forum!). Especially since Spotify significantly increased font size and line
spacing for no obvious reason [1] and no option to change it back even when
this was a (from my perspective) widley demanded feature, I have lost
confidence in the community process.

[1] [https://community.spotify.com/t5/ideas/v2/ideapage/blog-
id/i...](https://community.spotify.com/t5/ideas/v2/ideapage/blog-
id/ideas_live/article-id/10934/page/10#comments)

------
amd_
Interesting that I can't listen to Spotify while running certain debuggers -
not that its hard to by pass this "feature".

------
finicky
i'm so confused as to why Spotify removed the ability to search within a
playlist recently. such a useful feature is now gone, really leaves a sour
taste in my mouth.

------
hello_moto
SAP Lumira ([http://saplumira.com/](http://saplumira.com/)) also uses
JavaScript/HTML5 with similar approach to Spotify for the desktop application.

------
staticelf
Can we please stop linking to Quora articles? Just post it on pastebin or
something similar. It's silly to post to a place where you need to signup in
order to read the material.

------
mahouse
If you feel like the Spotify desktop application is slow, you can try and use
play.spotify.com instead—it's almost the same, and you can even use AdBlock on
it.

