Skip to content

Playlist Management

This documentation provides an overview of the playlist management system. The playlist is managed through a store with specific reducers that handle different playlist operations.

playlists

Store Reducers

The store implements two main reducers to manage playlist operations:

1. Add song in the playlist

Purpose: Initialize a new playlist session.

Behavior:

  • Clears any existing playlist content completely
  • Adds the provided songs as a new playlist
  • Automatically begins playback from the first song in the new playlist

Use Case:

  • Starting playback of a new album
  • Switching to a different playlist
  • Initializing the player with fresh content

2. Add recommendations in the playlists

Purpose: Extend the current playlist without disrupting playback.

Behavior:

  • Preserves the currently playing song
  • Maintains the existing playlist order
  • Appends new songs to the end of the current playlist
  • Does not clear or reset any existing content

Use Case:

  • Adding "recommended" or "similar" songs to the queue
  • Extending the current listening session
  • Creating a continuous playback experience

Usage Flow

  1. New Playlist Creation:
  • Trigger addSongsInThePlaylist() with an array of song objects
  • The playlist will reset and begin playing the first song
  1. Playlist Extension:
  • While a song is playing, trigger addRecommendationsInThePlaylist() with additional song objects
  • New songs will be added to the queue without interrupting the current playback

Implementation Considerations

  • The current implementation doesn't support individual song removal
  • There is no direct method to reorder the playlist after creation
  • Both reducers expect properly formatted song objects

just a timepass anyways