Pre-Proposal for BrainzPlayer and ListenBrainz Integration

Pre-Proposal for BrainzPlayer and ListenBrainz Integration

This project aims to seamlessly integrate BrainzPlayer with ListenBrainz’s “Listening Now” feature to enhance the overall listening experience. By addressing current bugs and implementing playback control for Spotify and on-device players, the goal is to provide accurate and dynamic song status updates

Currently, I have identified the following scenarios and my approach to address them:

  1. Song is being played by the ListenBrainz app using BrainzPlayer:
    In this case, the player will display the state of this song exclusively. Playback and queue management can be fully supported here.
  2. Song is being played by any on-device music player:
    If a user isn’t using BrainzPlayer but is playing a song through another app (configured in settings), playback control can be managed using Media Sessions.
  3. Playing songs on external devices:
    When a user opts to listen through an external device, the “Listening Now” state from the ListenBrainz server will be shown using WebSockets. Playback control will be possible if the user is using Spotify.

Spotify Integration

Spotify’s Android SDK provides two key libraries:

  • App Remote Library: Useful for controlling Spotify app playback.
  • Authorization Library: Helps obtain a user access token for interacting with Spotify Web API.

Using the Spotify Web API, I can:

  • Fetch and display the currently playing queue.
  • Add tracks to the queue.
  • Fetch and export playlists from Spotify and ListenBrainz.

YouTube Data API

The YouTube Data API can be leveraged to:

  • Search for songs, fetch playlists, and retrieve metadata.
  • However, it doesn’t offer direct playback control, limiting our ability to support queuing.

Additional Features

  1. Playback Control via Media Sessions:
    I aim to enhance the app’s capability to control playback from players like YouTube Music and others. Currently, we only send listens, but by utilizing Media Sessions, we can display the song in our mini-player and control basic playback (play, pause, seek, progress).
  • Note: Queuing won’t be possible for these players.
  1. Delete Unwanted Listens:
    Users often accumulate unwanted listens, like podcasts from Spotify or standard YouTube videos. I plan to introduce an option for users to delete these listens to maintain a more accurate listening history.

Summary of Deliverables:

  • Integration of BrainzPlayer with ListenBrainz’s “Listening Now” state.
  • Fix all bugs related to BrainzPlayer and revamp the UI.
  • Spotify integration for remote playback control and queue management.
  • Support for fetching playlists and song metadata using the YouTube Data API.
  • Playback control of on-device players through Media Sessions.
  • Feature to delete unwanted listens for better listening history management.

Hi, just to make it clear, we will not be aiming for live track progress updates from other players, just showing what track is being played right now globally on all devices currently being logged in with the LB account. This is to be very simple done via LB API (even socket logic and REST Api is already written). The main piece of this project is playback. We are only interested in just starting playback of those songs which is already implemented. What we want is a queue system which automatically plays songs in background one by one with the help of ListenSubmissionService. For this you will need to research on background intent launch limitations and limitations by Spotify android SDK. Also, how this automatic playback should occur is a point of interest. What actual android API will be used? Will it be a separate Service? Will it be based on callbacks from ListenSubmissionService?

1 Like

What is BrainzPlayer?
I did a quick search and it seems to be an audio player, at the bottom of ListenBrainz page.
So, it seems already integrated, doesn’t it.
Or maybe it is too lightly integrated.

When I mentioned BrainzPlayer, I was actually referring to the player within the ListenBrainz Android app. The project I’m working on aims to integrate “Listening Now” and playback support into the app.

Listening Now will allow users to see what music is being played on other devices linked to their account, creating a more connected experience. Also, we’ve integrated ExoPlayer, enabling users to play their local music directly through the app.

So while the player on the website is already there, this integration is focused on enhancing the Android app’s capabilities to make it more interactive and convenient. Hope that clarifies things!

1 Like

@jesus2099 In android app, the BrainzPlayer is fairly limited to local songs on the device and is just like website player in terms of UI, stays at the bottom. We want to change that add remote playback via Spotify, Youtube and other avenues to the existing BrainzPlayer on the android app. The original idea in our mind is a seamless playback from multiple apps controlled via our app itself. Basically you can pick a playlist on LB and we will try to play songs we find on any medium sequentially as directed by the playlist. The proposal here talks very lightly about the core stuff we want and that is okay since its a pre-proposal.

1 Like