[Bug]: Chromecast current track not reflected on client #202

Closed
opened 2026-04-24 23:12:04 +02:00 by adam · 6 comments
Owner

Originally created by @dchawisher on GitHub (Jun 20, 2022).

Steps to reproduce

  1. Close the android app entirely and open it again. (Note: Other means of closing the socket, e.g. logging out of the android app, do not cause the issue.)
  2. Press the Chromecast button and select a player. (If you like, press the button to stop casting, then start another Chromecast session. It makes no difference.)
  3. Play any multitrack audiobook in which the saved position is beyond the first track. (Alternatively, play the audiobook, then press Chromecast. It makes no difference.)

Expected behaviour

  • Book begins playing from the Chromecast device from the last position.
  • The progress bar on the android app player displays that position.

Actual behaviour

  • The listening position within the track is treated as the listening position for the audiobook as a whole.
    • So, e.g., if you are at 1:20:10 of your audiobook, which is 0:15:02 of the second track, playback begins at 0:15:02 of the audiobook (that is, 0:15:02 of the first track).
    • This new position is saved, resulting in lost progress.
    • Note: On one occasion (out of more than a dozen controlled attempts), this bug did not occur, and the behavior described in the following bullet point occurred instead. I have no idea why.
  • Subsequent plays via Chromecast begin playing at the correct position, but only until the app is closed. (In those plays, the progress bar briefly displays the "track" position, but the audio that plays is from the correct position, and the progress bar corrects itself in a few seconds.)

Environment data

Audiobookshelf Version: 2.0.22, 2.0.21.

  • Android App? Version 0.9.49 (installed from play store).
  • iOS App?

Android Issue

Android version: 12

Device model: Pixel 4a

Stock or customized system: Stock

Originally created by @dchawisher on GitHub (Jun 20, 2022). ### Steps to reproduce 1. Close the android app entirely and open it again. (Note: Other means of closing the socket, e.g. logging out of the android app, do not cause the issue.) 2. Press the Chromecast button and select a player. (If you like, press the button to stop casting, then start another Chromecast session. It makes no difference.) 3. Play any multitrack audiobook in which the saved position is beyond the first track. (Alternatively, play the audiobook, then press Chromecast. It makes no difference.) ### Expected behaviour - Book begins playing from the Chromecast device from the last position. - The progress bar on the android app player displays that position. ### Actual behaviour - The listening position **within the track** is treated as the listening position for the audiobook as a whole. - So, e.g., if you are at 1:20:10 of your audiobook, which is 0:15:02 of the second track, playback begins at 0:15:02 of the audiobook (that is, 0:15:02 of the first track). - This new position is saved, resulting in lost progress. - Note: On one occasion (out of more than a dozen controlled attempts), this bug did not occur, and the behavior described in the following bullet point occurred instead. I have no idea why. - Subsequent plays via Chromecast begin playing at the correct position, but only until the app is closed. (In those plays, the progress bar briefly displays the "track" position, but the audio that plays is from the correct position, and the progress bar corrects itself in a few seconds.) ### Environment data Audiobookshelf Version: 2.0.22, 2.0.21. - [X] Android App? Version 0.9.49 (installed from play store). - [ ] iOS App? #### Android Issue Android version: 12 Device model: Pixel 4a Stock or customized system: Stock
adam added the bug label 2026-04-24 23:12:04 +02:00
adam closed this issue 2026-04-24 23:12:05 +02:00
Author
Owner

@dchawisher commented on GitHub (Jun 21, 2022):

I have no idea what I'm doing with Android Studio, but it seems like these log items might have something to do with the issue?

2022-06-21 15:05:39.040 28002-28002/com.audiobookshelf.app D/CastPlayer: seekTo 0 position 1163969    
2022-06-21 15:05:39.040 28002-28002/com.audiobookshelf.app D/CastPlayer: seekTo: Changing media item index from 2 to 0

I'm assuming "1163969" is the position in milliseconds and "0" is the first track. (That matches the position it went to during this test run.) The corresponding log lines from a playback that didn't have the problem (that is, a second or subsequent playback) were as follows:

2022-06-21 15:06:27.705 28002-28002/com.audiobookshelf.app D/CastPlayer: seekTo 0 position 114203
2022-06-21 15:06:27.705 28002-28002/com.audiobookshelf.app D/CastPlayer: seekTo: Same media index seek to position 114203
@dchawisher commented on GitHub (Jun 21, 2022): I have no idea what I'm doing with Android Studio, but it seems like these log items might have something to do with the issue? ``` 2022-06-21 15:05:39.040 28002-28002/com.audiobookshelf.app D/CastPlayer: seekTo 0 position 1163969 2022-06-21 15:05:39.040 28002-28002/com.audiobookshelf.app D/CastPlayer: seekTo: Changing media item index from 2 to 0 ``` I'm assuming "1163969" is the position in milliseconds and "0" is the first track. (That matches the position it went to during this test run.) The corresponding log lines from a playback that didn't have the problem (that is, a second or subsequent playback) were as follows: ``` 2022-06-21 15:06:27.705 28002-28002/com.audiobookshelf.app D/CastPlayer: seekTo 0 position 114203 2022-06-21 15:06:27.705 28002-28002/com.audiobookshelf.app D/CastPlayer: seekTo: Same media index seek to position 114203 ```
Author
Owner

@advplyr commented on GitHub (Jun 21, 2022):

I was able to replicate this. The audio player on the phone is always showing the first track, but if you first press play on an audiobook while already casting it will show correctly and play correctly on the chromecast device.

@advplyr commented on GitHub (Jun 21, 2022): I was able to replicate this. The audio player on the phone is always showing the first track, but if you first press play on an audiobook while already casting it will show correctly and play correctly on the chromecast device.
Author
Owner

@advplyr commented on GitHub (Jun 22, 2022):

I found the issue, will be fixed in the next release

@advplyr commented on GitHub (Jun 22, 2022): I found the issue, will be fixed in the next release
Author
Owner

@dchawisher commented on GitHub (Jun 22, 2022):

Wow. Thanks!

@dchawisher commented on GitHub (Jun 22, 2022): Wow. Thanks!
Author
Owner

@dchawisher commented on GitHub (Jun 22, 2022):

The fix works perfectly. Thanks again!

@dchawisher commented on GitHub (Jun 22, 2022): The fix works perfectly. Thanks again!
Author
Owner

@advplyr commented on GitHub (Jul 3, 2022):

Fixed in 0.9.50-beta

@advplyr commented on GitHub (Jul 3, 2022): Fixed in [0.9.50-beta](https://github.com/advplyr/audiobookshelf-app/releases/tag/v0.9.50-beta)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf-app#202