News for hackers. Stuff that matters.
Re:MusicKit JS by kitsunesoba on Saturday February 22, 2020 @03:51PM (#22393242)
Props to Apple for releasing this. The way Spotify has handled the deprecation of libspotify without a proper replacement and removing streaming/playback from their other SDKs has been extremely disappointing.
Re:MusicKit JS by DelightOne on Sunday February 23, 2020 @06:25AM (#22396341)
I'm kinda late to the party and I wonder. With streaming/playback, do you mean player control, playing sound or other missing features?

https://developer.spotify.com/documentation/web-playback-sdk...

Re:MusicKit JS by kitsunesoba on Sunday February 23, 2020 @10:48AM (#22397382)
libspotify and the old iOS Spotify SDK used to provide the ability to stream and play songs in your app, without having to play through a Spotify device or backgrounded Spotify app. This was particularly great in the case of libspotify because it was written in C, making it easy to bind to whichever language you preferred. It was complete enough to write an entire alternative client with.

It looks like this web playback SDK works by creating a local Spotify Connect device to play to, which I guess would technically work, but it’d be much nicer if it just directly played songs as libspotify did and now MusicKit JS does.

Re:MusicKit JS by DelightOne on Sunday February 23, 2020 @11:17AM (#22397594)
Hmm that sounds indeed much better! Sadly not C, but cross-platform JavaScript is still nice to have.

Is it possible to embed this in native apps with an embedded browser? Hmm sounds complicated, or is there a different way to integrate this (using the apis the library uses).

Re:MusicKit JS by kitsunesoba on Sunday February 23, 2020 @03:27PM (#22399317)
Embedding just the web player in native apps would be a pain due to communication between the native and web layer. If you just did the whole thing in JS (electron, etc) you’re barely any better off than the official client in terms of resource consumption, defeating much of the point of building an alternative client.

There are reverse engineered libraries available (mainly librespot[1]) but they come with the caveat of violating the EULA and risking the accounts used with it. AFAIK Spotify hasn’t banned anybody for using it yet, but it’s always a possibility.

[1] https://github.com/librespot-org/librespot

Re:MusicKit JS by DelightOne on Tuesday February 25, 2020 @02:54PM (#22416727)
Good that they limit use to Premium users, making them not lose money.

Thanks for the tip!

Re:MusicKit JS by benbristow on Saturday February 22, 2020 @02:29PM (#22392806)
Doesn’t seem like there’s an NPM package. Would be better if you could import it with Webpack and use await rather than callbacks etc.
Re:MusicKit JS by mrcarruthers on Saturday February 22, 2020 @03:08PM (#22393027)
Well it's using promises, so you can just await those.

But agreed, the documentation looks like it was written in 2014/2015.

Re:MusicKit JS by zodiakzz on Saturday February 22, 2020 @09:12PM (#22394646)
The "user's cloudAlbums" example is awful. Might as well use callbacks if you aren't gonna chain promises to avoid callback hell.
Re:MusicKit JS by tantalor on Saturday February 22, 2020 @10:18PM (#22394870)
Where is that? Link?
Re:MusicKit JS by zodiakzz on Saturday February 22, 2020 @10:45PM (#22394977)
Under the "JavaScript Methods" heading

https://developer.apple.com/documentation/musickitjs#3004817

    music.authorize().then(function() {
        music.api.library.albums.then(function(cloudAlbums) {
            // user's cloudAlbums
        });
    });

    Should be:

    music.authorize().then(function() {
        return music.api.library.albums;
    }).then(function (cloudAlbums) {
        // user's cloudAlbums
    });
Re:MusicKit JS by lqs469 on Saturday February 22, 2020 @09:16PM (#22394654)
It looks like Apple doesn't want to use the NPM ecosystem.
Re:MusicKit JS by jamsinclair on Saturday February 22, 2020 @07:25PM (#22394273)
A 99 USD commercial web API. This one, and their other endpoints, require being part of paid Apple Developer program. I understand, but it's frustrating if you're wanting to play around or use in free open source.
Re:MusicKit JS by rochak on Sunday February 23, 2020 @12:39AM (#22395338)
This is also the reason why I couldn’t contribute to an open source project that required being part of Apple Developer Program.
Re:MusicKit JS by saagarjha on Saturday February 22, 2020 @07:30PM (#22394302)
Do any competing platforms have a similar API with a less imposing barrier?
Re:MusicKit JS by mixedCase on Saturday February 22, 2020 @11:07PM (#22395074)
Spotify and Deezer, OTOH.
Re:MusicKit JS by cptskippy on Saturday February 22, 2020 @08:09PM (#22394445)
I'm ok with it.

It deincentivizes abuse not unlike how SSL originally worked before it became a farming operation.

Re:MusicKit JS by devwastaken on Saturday February 22, 2020 @08:46PM (#22394554)
I'm curious how SSL is being abused.
Re:MusicKit JS by cptskippy on Saturday February 22, 2020 @11:00PM (#22395039)
Once upon a time businesses had to submit paper work verifying their business to a registrar to get an SSL cert. It wasn't just about encryption but also identity.

I remember as late as 2004 trying to scrounge up copies of our business license to fax or mail into our registrar.

Today the SSL cert has lost it's identity aspect and is just a sign of secure communication, not trusted.

Re:MusicKit JS by duskwuff on Sunday February 23, 2020 @12:01AM (#22395240)
> Once upon a time businesses had to submit paper work verifying their business to a registrar to get an SSL cert. It wasn't just about encryption but also identity.

And those policies made it impossible for personal and hobbyist sites to use secure communications, while doing very little to actually prevent abuse. (Most of the apparent "success" of these policies was simply because the motivations for abuse were lower at the time.)

Re:MusicKit JS by devwastaken on Sunday February 23, 2020 @03:02AM (#22395699)
SSL was never a sign of trust. That's what people made up. The algorithm has no intention of 'trust'.

Ease of SSL certs provides significantly better protection from threats between you and legitimate sites than potential illigitimate sites.

Re:MusicKit JS by cptskippy on Sunday February 23, 2020 @05:12PM (#22399906)
Originally SSL required identity verification and financial costs were very high.

Fraudulent SSL certs weren't a thing because the barrier to entry way so high and the rewards for spoofing a site were low since e-commerce was insignificant.

Re:MusicKit JS by nine_k on Saturday February 22, 2020 @11:25PM (#22395142)
Extended validation certificates still exist, and do require the paperwork.
Re:MusicKit JS by tonyedgecombe on Sunday February 23, 2020 @07:51AM (#22396602)
As do code signing certs (for Windows developers).
Re:MusicKit JS by cptskippy on Sunday February 23, 2020 @05:13PM (#22399911)
Yes and no one really gives a crap about them anymore.
Re:MusicKit JS by PedroBatista on Saturday February 22, 2020 @07:38PM (#22394330)
I don't get it.

What's the use for this? ( in a mainstream product way, not in some cool personal private project way)

Re:MusicKit JS by duskwuff on Saturday February 22, 2020 @10:43PM (#22394969)
One real-world use case is on Genius.com, where it can be used to play songs (or previews, for users without Apple Music) while reading an analysis of their lyrics.
Re:MusicKit JS by lqs469 on Saturday February 22, 2020 @09:19PM (#22394671)
Perhaps the place where you are most likely to see it is the showcase page for new Apple products, Just like ARkit before.
Re:MusicKit JS by parhamn on Saturday February 22, 2020 @05:15PM (#22393696)
I've always wondered why Netflix and all don't have clip widgets that you can link/embed on other sites. It is essentially free mass embedded paywalls.
Re:MusicKit JS by GuiA on Saturday February 22, 2020 @05:44PM (#22393848)
I can see the short term benefit, but inevitably some big content distributor would want to opt out on condition of providing their content to Netflix due to some disadvantage they perceive with it. From there more and more content providers would want to opt out (“Disney does it, we should do it too because it makes us more like Disney”) and then the feature becomes useless and people who use it get mad.
Re:MusicKit JS by echelon on Saturday February 22, 2020 @09:07PM (#22394627)
They can do it once their library is 100% Netflix originals.
Re:MusicKit JS by smnrchrds on Sunday February 23, 2020 @01:10AM (#22395416)
Tangential questions: has anyone done an analysis of share of originals in Netflix library as a function of time?
Re:MusicKit JS by staticvar on Saturday February 22, 2020 @02:14PM (#22392717)
You can play your iTunes library online now?
Re:MusicKit JS by dewey on Saturday February 22, 2020 @02:19PM (#22392752)
Your Apple Music library, this SDK already exists for years so it’s not exactly new.
Re:MusicKit JS by crooked-v on Saturday February 22, 2020 @06:28PM (#22394051)
If you have "Sync Library" turned on (the feature's gone through several renames by now), it will also let you play local mp3s that have been uploaded.
Re:MusicKit JS by gyrgtyn on Saturday February 22, 2020 @04:22PM (#22393414)
can a web app play music and run js with the screen off?
Re:MusicKit JS by dawnerd on Saturday February 22, 2020 @03:29PM (#22393139)
About time. Rdio has such an amazing embed api (I built the JS api for it at the time and a site that was really heavily used). Total shame when Apple bought and shut them down. Maybe I can bring that old site out from the dead. Hmm
Re:MusicKit JS by mackey on Saturday February 22, 2020 @03:40PM (#22393195)
Apple did not buy Rdio, they basically went out of business and sold what they left to Pandora.
Re:MusicKit JS by dawnerd on Saturday February 22, 2020 @07:52PM (#22394379)
Hmm it's been a while. I don't know why Apple stuck in my brain. Maybe it was another service similar...

But still, I miss rdio.

Re:MusicKit JS by scarface74 on Sunday February 23, 2020 @12:20AM (#22395287)
Re:MusicKit JS by dawnerd on Sunday February 23, 2020 @12:32PM (#22398151)
Oh very likely. I don’t really remember the name but they interface looks so familiar.
Re:MusicKit JS by holler on Saturday February 22, 2020 @06:23PM (#22394035)
I used to love using Rdio and thought their site was the best designed music app at the time! Was bummed when it shut down.