Closed durasj closed 6 years ago
I actually have an onTrackDidChange
callback. Currently it just returns the URL. Ideally we could return all the metadata that we have, but there is one wrinkle: In some cases we don't have the metadata at the moment we start playing. If a user drags in a file, we start playing it immediately, but we won't know the metadata until jsmediatags (or soon @Borewit's music-metadata) looks at it, which is async.
Should we have a way to register a callback to be called when the metadata for the current track changes?
The problem with the onTrackDidChange
is that it won't get triggered if the music is paused or stopped. But please correct me if I'm wrong. So that the title could be reverted on stop. But when we are already implementing some callback it would be cool to include other states so I can use it straight away also for media buttons integration.
I suppose a kind of proxy is used to retrieve the Spotify audio stream, have you considered to encode the metadata back into the audio output stream?
Other ways to pass the audio, but way more complex, may be UPNP or Apple AirPlay, which support passing metadata.
Hey @Borewit, I would like to concentrate on the basic Webamp-without-Spotify use case first. I've mentioned the Spotify because it does excatly what I've mentioned - a good job at updating the window title in both the web player and the native app.
This is done
When playing some music in the bg, it would be cool to see the current song in the format
Artist - Song Name
- how it's for example on Spotify. I guess this wasn't proposed so far.IMHO the best way would be to add a new callback for webamp like
onPlaybackChange
or something with the current state of playback (playing, paused, idle?). That way it can be implemented for both the web version and desktop version and won't influence other projects using it on their sites. I'll also need such callback for the desktop version for some integration with the OS.What do you think?