SynQApp / Extension

Your music companion for the web, with a portable mini player and the ability to listen to any music link on your preferred service!
https://www.synqapp.io
Apache License 2.0
26 stars 5 forks source link

Created the IObserverEmitter interface and implemented it for Apple Music #6

Closed tekkeon closed 1 year ago

tekkeon commented 1 year ago

Created a new interface called IObserverEmitter. It's a basic interface whose implementations are responsible for observing changes to their respective music service and emitting events needed by the SynQ mini controller for it to display the current state of the music service. The interface simply contains an observe method for starting the monitoring of changes and an unobserve method for cleaning up any listeners.

Then, I implemented this interface for Apple Music. MusicKit has a built-in event system for their player, making it relatively easy to react to changes. I was able to hook into that system and use the existing controller for Apple Music to get the current state in the object shapes we need and package it into an event to send to the SynQ mini controller.