Hello,
i recently stumbled over a Project called FaultVinyl. It is basically a NFC Reader hooked to a Mac and NFC Tags that stick on the backside of printed Albumcovers. When you place a Tag on the reader, the Computer plays the assigned Playlist of Album. I am very interested to build this for my own Setup but i am a bloody beginner in programming.
So i thought why not starting with learning Javascript and chose MusicKit JS as my first Playground.
After digging through some basic courses and the Musickit Docs and after i found a good Example (https://codepen.io/leemartin/full/bKEeZL/)i buit a HTML File with a Musicplayer integrated.
When i launch it without being Singed in to Apple Music, i get the 30 second previews of the desired Media played in Chrome.
When i log in, the media is queued but will not play.
After i found the console.log(MusicKit.errors); Function, the console show this Error:
"MEDIA_KEY: NotSupportedError: Failed to execute 'createMediaKeys' on 'MediaKeySystemAccess': EME use is not allowed on unique origins. at EncryptedSession.KeySession.dispatchKeyError (https://js-cdn.music.apple.com/musickit/v1/musickit.js:13:82640) at https://js-cdn.music.apple.com/musickit/v1/musickit.js:13:84289"
I am authorized (MusicKitinstance.isAuthorized = true), have a musicUserToken, the Player has a Queue (MusicKitinstance.player.queue.items = Array(17)) and so on. As far as i can tell, everything looks good in my approach.
Any help is appreciated.
Best wishes
Christian
My code is pretty easy (of course my developerToken is correct in my Version):
}
});
});
});