[PR #1730] [MERGED] Android: fix Cast volume to control receiver #1672

Closed
opened 2026-04-25 00:00:31 +02:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/advplyr/audiobookshelf-app/pull/1730
Author: @eagleeyetom
Created: 11/18/2025
Status: Merged
Merged: 11/23/2025
Merged by: @advplyr

Base: masterHead: feature/cast-volume-fix


📝 Commits (1)

  • dcaa190 Android: fix Cast volume to control receiver

📊 Changes

2 files changed (+74 additions, -7 deletions)

View changed files

📝 android/app/src/main/java/com/audiobookshelf/app/player/CastPlayer.kt (+31 -7)
📝 android/app/src/main/java/com/audiobookshelf/app/player/PlayerNotificationService.kt (+43 -0)

📄 Description

  • Route hardware volume keys to Cast via MediaSession VolumeProvider
  • Use CastSession.volume (0–1) mapped to 0–100; clamp and step by 1
  • Update provider with actual device volume after each change (prevents stalls)
  • Drop stream-volume/polling attempts and other leftovers
  • Expose get/set/adjust device volume commands to the player

Brief summary

Currently when you try to change the volume while casting, it changes the volume of the phone/tablet. It's very inconvenient as you need to find a remote to change the volume of the receiver.

Which issue is fixed?

Fixes #584

Pull Request Type

Android/backend

In-depth Description

Not sure if it's the best solution, but it changes the behavior of the app to the desired one. It tries to change the volume by 1 and if it's not supported, increases the treshold.

How have you tested this?

Install the APK, cast -> try to change the volume.

Screenshots

N/A


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/advplyr/audiobookshelf-app/pull/1730 **Author:** [@eagleeyetom](https://github.com/eagleeyetom) **Created:** 11/18/2025 **Status:** ✅ Merged **Merged:** 11/23/2025 **Merged by:** [@advplyr](https://github.com/advplyr) **Base:** `master` ← **Head:** `feature/cast-volume-fix` --- ### 📝 Commits (1) - [`dcaa190`](https://github.com/advplyr/audiobookshelf-app/commit/dcaa19071fd8512e405fedb0024d95b30197003e) Android: fix Cast volume to control receiver ### 📊 Changes **2 files changed** (+74 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `android/app/src/main/java/com/audiobookshelf/app/player/CastPlayer.kt` (+31 -7) 📝 `android/app/src/main/java/com/audiobookshelf/app/player/PlayerNotificationService.kt` (+43 -0) </details> ### 📄 Description - Route hardware volume keys to Cast via MediaSession VolumeProvider - Use CastSession.volume (0–1) mapped to 0–100; clamp and step by 1 - Update provider with actual device volume after each change (prevents stalls) - Drop stream-volume/polling attempts and other leftovers - Expose get/set/adjust device volume commands to the player <!-- For Work In Progress Pull Requests, please use the Draft PR feature, see https://github.blog/2019-02-14-introducing-draft-pull-requests/ for further details. If you do not follow this template, the PR may be closed without review. Please ensure all checks pass. If you are a new contributor, the workflows will need to be manually approved before they run. --> ## Brief summary Currently when you try to change the volume while casting, it changes the volume of the phone/tablet. It's very inconvenient as you need to find a remote to change the volume of the receiver. ## Which issue is fixed? Fixes #584 ## Pull Request Type Android/backend ## In-depth Description Not sure if it's the best solution, but it changes the behavior of the app to the desired one. It tries to change the volume by 1 and if it's not supported, increases the treshold. ## How have you tested this? Install the APK, cast -> try to change the volume. ## Screenshots N/A --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2026-04-25 00:00:31 +02:00
adam closed this issue 2026-04-25 00:00:31 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf-app#1672