MusicKit.getInstance().play() broken?

If I try this:

MusicKit.getInstance ().setQueue({ album: '1025210938' }).then (() => {

MusicKit.getInstance ().play ();

});


I get an Error:

console.js:35 TypeError: Cannot read property 'container' of null

at Player.<anonymous> (musickit.js:13)

at musickit.js:13

at Object.next (musickit.js:13)

at fulfilled (musickit.js:13)

at <anonymous>


I discovered the same behaviour on https://music.zacharyseguin.ca/ and https://s.codepen.io/leemartin/debug/fcb4212e146382fe993939a8785576e5


Can anybody confirm that MusicKit.getInstance().play() or MusicKit.getInstance().player.play() currently doesn't work?


Replies

I poked around with that for 1 1/2 Days now and i cant get any playback as long as i am authorized.

When i unauthorize myself and close the authorization popup, the player will playback the preview file.

poking around in MusicKit.errors i found "Failed to execute 'createMediaKeys' on 'MediaKeySystemAccess': EME use is not allowed on unique origins." as an error.

Maybe it's because im on Windows and using Chrome?


Long Story short: Yes, i can confirm this for my App as well - but with an other Player (see my other post)

Christian -


Both of these methods are currently functioning. I was able to login to both links provided and things work as expected. Are you able to log in to those pages and playback content, or is this specific to your code in development?


If you wouldn't mind filing a Radar and including any network logs, code samples, and console messages - this will help with our investigations to why you are seeing this issues.

I'm still able to reproduce this exact console error in Chrome (Safari and Firefox fine) after calling MusicKit.getInstance().play() in my console after authorizing. Was there a solution?

I’m having the same issue described here: https://forums.developer.apple.com/message/350355#350355 Was this ever resolved?

Solution:


In chrome at least, musicKit.js requires that the site being hosted is using SSL. This was not a problem for me running everything locally, but if I even ran against my network's IP address, SSL was required. I stopped getting the errors once I set up https on my server.