Skip to content

Module detail: playback

enteraname74 edited this page May 19, 2025 · 2 revisions

This module contains all the playback logic (player, notification, ...).

Notification

The SoulSearchingNotification interface is used to abstract, in the common code, the notification system.

interface SoulSearchingNotification {
    suspend fun updateNotification(
        playbackManagerState: PlaybackManagerState.Data,
        cover: ImageBitmap?,
    )
    fun dismissNotification()
}

An implementation is then provided for each platform

Android

On Android, there is two implementation for the notification. One for devices below Android 13, and one for devices above. The difference between these implementations is that devices below Android 13 will use intents to handle notification actions, whereas devices above will use the media session directly. Indeed, there was some issues regarding media session buttons not being shown on the notification for devices below Android 13.

Desktop

Currently, there is no notification while a music is playing has the implementation is quite tricky to do. There is some commented code for a simple notification showing the current played music information but there is some issues with it:

  • It does not support user action (play/paus, next, ...)
  • It needs some dependencies installed on the user system

The last point could be fixed by adding the required dependencies in the flatpak version of the app. However, it's something that will take some time to do and hopefully I will make it work someday.

PlaybackManager

This is the class that manages all things related to the playback (player, notification, progress job, ...). It exposes states for the app to listen to and show the relevant information. These states are the combination of the states of all the components of the playback system. The aim is to ensure that all components of the playback are synced correctly.

PlaybackListManager

The PlaybackManager delegates the work done on the played list to the PlaybackListManager to avoid having a huge PlaybackManager and keeping it as a synchronizing class between all components of the playback.

SoulSearchingPlayer

This interface represents the player of the application. There is an Android and Desktop implementation.

Android

The android implementation uses MediaPlayer.

In the future, an ExoPlayer implementation should be done.

Desktop

The Desktop implementation uses Vlcj.

Clone this wiki locally