Live data from Hacker News

How is Javascript used within the Spotify desktop application?

quora.com

11–20 of 100 posts

Re: How is Javascript used within the Spotify desktop application?

#11

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.

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.

Re: How is Javascript used within the Spotify desktop application?

#12

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.

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…

I've frequently been unable to pause or change the volume of the music for tens of seconds because the user interface stalled. Completely inexcusable for an app that is ostensibly for playing music.

On the good side, since all the webviews are right there in the app as renamed zip files, I suppose they could easily be edited to cut out some of the bottlenecks?

Re: How is Javascript used within the Spotify desktop application?

#13
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.

Re: How is Javascript used within the Spotify desktop application?

#14

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.

Add to that the massive start-up time for the Windows client. A fresh instance Spotify from a rebooted machine takes ages to gain full functionality. If you quit in the middle of a good playlist, most of the time you'll be able to continue playing from where that playlist left off. If you opened Spotify to find a song or move to another playlist, you'll be waiting a while.

I just started Spotify with a stopwatch:

2:26 for the main Browse to completely render

2:42 for the live search window to give suggestions

2:52 (+10 seconds) for the search to return a result

I once thought it was because of the massive local library that had to be loaded and sorted into Spotify, but I've done away with local files to try to speed up the start up. The results on my laptop are not any better. Maybe it's because I've been updating the same client since 2012?

Re: How is Javascript used within the Spotify desktop application?

#15

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.

The recent removal of the system tray icon is anti-user. It provided users with easy access to Play/Pause from the system tray, but that meant users spent less time in the app, so the system tray icon was removed completely.

Re: How is Javascript used within the Spotify desktop application?

#16

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.

Add to that the massive start-up time for the Windows client. A fresh instance Spotify from a rebooted machine takes ages to gain full functionality. If you quit in the middle of a good playlist, most of the time you'll be able to continue playing from where that playlist left off. If you opened Spotify to find a song or move to another playlist, you'll be waiting a while. I just started Spotify with a stopwatch: 2:2…

Wow.. I agree that Spotify isn't the most lightweight application, but it doesn't feel much heavier than, say, Chrome on my Linux installation.

Are you on a mechanical hard drive perhaps?

The network performance though is quite bad, searching for some song often fails or just is very slow to load and render.

Re: How is Javascript used within the Spotify desktop application?

#17
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.

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.

Re: How is Javascript used within the Spotify desktop application?

#18

Earlier quoted context omitted.

Add to that the massive start-up time for the Windows client. A fresh instance Spotify from a rebooted machine takes ages to gain full functionality. If you quit in the middle of a good playlist, most of the time you'll be able to continue playing from where that playlist left off. If you opened Spotify to find a song or move to another playlist, you'll be waiting a while. I just started Spotify with a stopwatch: 2:2…

Wow.. I agree that Spotify isn't the most lightweight application, but it doesn't feel much heavier than, say, Chrome on my Linux installation. Are you on a mechanical hard drive perhaps? The network performance though is quite bad, searching for some song often fails or just is very slow to load and render.

Should a music player be anywhere near as heavy as Chrome? A web browser is a pretty immensely complicated thing (CSS, DOM rendering, Javascript JIT compiler, etc.).

Similar criticisms have been made of iTunes over the years (though I find it's not bad in the current version). Things like laggy scrolling are a bit understandable there, since they've defaulted to the grid of album covers view for a while. But Spotify looks like it's all just columns of text and a few thumbnails on the side?

Re: How is Javascript used within the Spotify desktop application?

#19

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.

You also can't ctrl-f within a page, which makes finding things really annoying.

You USED to be able to. It's very annoying that that feature is gone.

Re: How is Javascript used within the Spotify desktop application?

#20
post #5

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.

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.
Post reply on HN