-
Notifications
You must be signed in to change notification settings - Fork 9
Module detail: playback
This module contains all the playback logic (player, 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
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.
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.
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.
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.
This interface represents the player of the application. There is an Android and Desktop implementation.
The android implementation uses MediaPlayer.
In the future, an
ExoPlayerimplementation should be done.
The Desktop implementation uses Vlcj.