Skip to content

Conversation

@solar141
Copy link

@solar141 solar141 commented Oct 5, 2025

Brief summary

This PR fixes two issues related to audio playback in the Audiobookshelf client: preventing multiple audio streams from playing simultaneously and ensuring chapter previews stop at the end of the chapter without auto-advancing.

Which issue is fixed?

Chapter Preview Doesn’t Stop at Chapter End
Multiple Audio Streams Playing Simultaneously

In-depth Description

Multiple Audio Streams Playing Simultaneously:

The issue occurs when multiple audio streams (e.g., from different chapters or previews) start playing at the same time, leading to overlapping sounds.
Solution: Added event listeners to detect when a new audio stream begins and automatically pause any currently playing audio. This ensures only one stream is active at a time.
Updated files: client/pages/audiobook/_id/chapters.vue and client/players/LocalAudioPlayer.js.
This is a common edge case for users previewing multiple chapters quickly, improving the overall user experience by preventing audio chaos without affecting core playback logic.

Chapter Preview Doesn’t Stop at Chapter End:

The problem is that when previewing a single chapter, the player auto-advances to the next chapter instead of stopping at the end.
Solution: Removed the auto-advance logic specifically for single-chapter preview mode, allowing the playback to end naturally at the chapter's conclusion.
Updated file: client/pages/audiobook/_id/chapters.vue.
This fix targets preview functionality, which is useful for users scanning books, and doesn't impact full audiobook playback.

How have you tested this?

Open an audiobook page in a local development environment (run npm run dev).
Start playing a chapter preview.
Quickly start another chapter preview.
Verify that the first audio pauses immediately when the second starts, with no overlap.
Test with multiple browsers/tabs to simulate concurrent plays.
Ensured no regression in standard full-book playback.

Screenshots

Copy link
Contributor

@nichwall nichwall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neither of the changes behave differently or fix the issues mentioned in my testing.

this.destroyAudioEl()
}
// stop at end of chapter
this.destroyAudioEl()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not work if a chapter ends in the middle of a track.


play() {
// Emit pause-chapter event to stop any other chapter playing
if (this.ctx.$eventBus) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not stop chapters from playing when I tested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants