-
Notifications
You must be signed in to change notification settings - Fork 0
Description
I want to add a feature that tracks the number of times a song has been played. Add a new int field named NumberOfStreams to the SongMetadata table. Update existing SongMetadata records to 0 in the migration if necessary.
When a song is played for at least 30 seconds, it counts as a stream. Skipping ahead using the player bar progress bar does not count as playing (watch the seeking and seeked events to detect seeking). It must be played continuously for at least 30 seconds to count as a stream.
When a song is streamed, update the NumberOfStreams count using an atomic update.
Display the stream count on each Song card. Album cards do not need to display stream count. Also display the stream count on the song player page. On the album player / playlist player page, display the stream count in the track list table.
Create an event than can be invoked when the count is updated. Each place the count is displayed should subscribe to the event so the count can be updated everywhere in real time.