Skip to content

Feat: Ability to use Audiobookshelf Sessions/ HLS Stream#1887

Merged
marcelveldt merged 12 commits into
music-assistant:devfrom
fmunkes:audiobookshelf_hls
Jan 19, 2025
Merged

Feat: Ability to use Audiobookshelf Sessions/ HLS Stream#1887
marcelveldt merged 12 commits into
music-assistant:devfrom
fmunkes:audiobookshelf_hls

Conversation

@fmunkes

@fmunkes fmunkes commented Jan 19, 2025

Copy link
Copy Markdown
Contributor

Updated 01/19 14:20 documentation part

This PR introduces the ability to use an HLS stream for audiobooks both audiobooks and podcasts. This allows to have an audiobook to be split among multiple files, as this is effectively hidden from Music Assistant.

Details

  • ABS:
    • We can acquire a Session for podcasts or audiobooks in ABS, as long as we provide a unique device id in our Device Info Parameters
    • A transcoding session (that's what we use here) launches an ffmpeg process at ABS providing an HLS stream.
    • ffmpeg process only terminates, when we close the session.
  • Implementation:
    • I used the device id approach of the jellyfin provider, and then added the id of the media item the session is for. This allows a session per media item.
    • I added two config options - HLS for podcast, HLS for audiobooks
      • For audiobooks default is true.
      • For podcasts default is false.
    • If a session is need for audiobooks is determined automatically.
    • Schema has been updated for sessions.
    • Logging: I added a couple of debug logging information.
  • Advice needed/ open questions:
    • I currently just collect the ids of open sessions in a list[str].
    • I close all open sessions when we shutdown Music Assistant. I figured that's the only safe place to do so.
    • Reasoning:
      • If I were to close the session once on_played is called, a potentially running parallel stream of the same media item to another speaker would terminate as well.
      • Even if that's not the case, I think mass caches the stream details, i.e. get_stream_details would not be called again when the item is replayed.
    • Is the approach in place ok? Is there a better place to close open sessions?
    • Shall I limit the amount of sessions possible, and then maybe raise an error once we hit that limit? I could add another config option for the amount of possible open sessions.
  • Possible improvements:
    • We could potentially update the time spent in that session, which would update the ABS statistics view. For me that's very low priority as I don't see an easy way of accessing the time spent (i.e. including possible seeking by user etc, not the media progress!) on that stream.
  • Remarks:
    • on_played works nicely now, progress reporting to ABS seems functional.
      Thanks for that!

Documentation update:

If that PR is merged, then:

Known Issues/ Notes:

  • Restarting Audiobookshelf terminates all open sessions. Music Assistant has no way to know this, so you must reload the provider. Otherwise the stream of your audiobook will be not available.

Comment thread music_assistant/providers/audiobookshelf/__init__.py Outdated
Comment thread music_assistant/providers/audiobookshelf/__init__.py Outdated
Comment thread music_assistant/providers/audiobookshelf/__init__.py Outdated
Comment thread music_assistant/providers/audiobookshelf/__init__.py
Comment thread music_assistant/providers/audiobookshelf/abs_schema.py

@marcelveldt marcelveldt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good, nice work!

@marcelveldt marcelveldt merged commit fe63c1f into music-assistant:dev Jan 19, 2025
@fmunkes fmunkes deleted the audiobookshelf_hls branch January 19, 2025 20:26
@OzGav

OzGav commented Jan 20, 2025

Copy link
Copy Markdown
Contributor

@fmunkes I have added the note above but does this now mean the existing note about having to merge multi file audiobooks can be removed?

@fmunkes

fmunkes commented Jan 20, 2025

Copy link
Copy Markdown
Contributor Author

@fmunkes I have added the note above but does this now mean the existing note about having to merge multi file audiobooks can be removed?

Yes, that can be remove entirely, thanks!

github-actions Bot pushed a commit that referenced this pull request Jun 8, 2026
Update music-assistant-frontend to version
[2.17.181](https://github.com/music-assistant/frontend/releases/tag/2.17.181)


- Fix queue items disappearing in fullscreen player (by @MarvinSchenkel
in [#1874](music-assistant/frontend#1874))
- Add translation key for now playing badge (by @MarvinSchenkel in
[#1889](music-assistant/frontend#1889))

## 🚀 Features and enhancements

- Refactor heart icon and add it to the artist page (by @stvncode in
[#1891](music-assistant/frontend#1891))
- Add back subtitle for discover page (by @stvncode in
[#1890](music-assistant/frontend#1890))
- Bigger tiles on mobile (by @stvncode in
[#1887](music-assistant/frontend#1887))

## 🐛 Bugfixes

- Fix self-sustaining WebRTC reconnect storm in remote transport (by
@MarvinSchenkel in
[#1888](music-assistant/frontend#1888))
- Subtle placeholder for both dark and light mode (by @stvncode in
[#1886](music-assistant/frontend#1886))

## 🧰 Maintenance and dependency bumps

<details>
<summary>8 changes</summary>

- Add built-in playlists for favorites and random tracks (by @OzGav in
[#1876](music-assistant/frontend#1876))
- Chore(deps): Bump ludeeus/action-require-labels from 1.1.0 to 2.0.0
(by @[dependabot[bot]](https://github.com/apps/dependabot) in
[#1878](music-assistant/frontend#1878))
- Chore(deps): Bump happy-dom from 20.9.0 to 20.10.2 (by
@[dependabot[bot]](https://github.com/apps/dependabot) in
[#1879](music-assistant/frontend#1879))
- Chore(deps): Bump marked from 18.0.3 to 18.0.5 (by
@[dependabot[bot]](https://github.com/apps/dependabot) in
[#1880](music-assistant/frontend#1880))
- Chore(deps-dev): Bump @types/node from 25.9.1 to 25.9.2 (by
@[dependabot[bot]](https://github.com/apps/dependabot) in
[#1881](music-assistant/frontend#1881))
- Chore(deps): Bump @tanstack/vue-form from 1.32.0 to 1.33.0 (by
@[dependabot[bot]](https://github.com/apps/dependabot) in
[#1882](music-assistant/frontend#1882))
- Chore(deps): Bump vue-i18n from 11.4.4 to 11.4.5 (by
@[dependabot[bot]](https://github.com/apps/dependabot) in
[#1883](music-assistant/frontend#1883))
- Chore(deps): Bump reka-ui from 2.9.8 to 2.9.9 (by
@[dependabot[bot]](https://github.com/apps/dependabot) in
[#1884](music-assistant/frontend#1884))
</details>


## 🙇 Contributors

@MarvinSchenkel, @OzGav and @stvncode

Co-authored-by: stvncode <25082266+stvncode@users.noreply.github.com>
anatosun pushed a commit to anatosun/music-assistant-server that referenced this pull request Jun 14, 2026
Update music-assistant-frontend to version
[2.17.181](https://github.com/music-assistant/frontend/releases/tag/2.17.181)


- Fix queue items disappearing in fullscreen player (by @MarvinSchenkel
in [music-assistant#1874](music-assistant/frontend#1874))
- Add translation key for now playing badge (by @MarvinSchenkel in
[music-assistant#1889](music-assistant/frontend#1889))

## 🚀 Features and enhancements

- Refactor heart icon and add it to the artist page (by @stvncode in
[music-assistant#1891](music-assistant/frontend#1891))
- Add back subtitle for discover page (by @stvncode in
[music-assistant#1890](music-assistant/frontend#1890))
- Bigger tiles on mobile (by @stvncode in
[music-assistant#1887](music-assistant/frontend#1887))

## 🐛 Bugfixes

- Fix self-sustaining WebRTC reconnect storm in remote transport (by
@MarvinSchenkel in
[music-assistant#1888](music-assistant/frontend#1888))
- Subtle placeholder for both dark and light mode (by @stvncode in
[music-assistant#1886](music-assistant/frontend#1886))

## 🧰 Maintenance and dependency bumps

<details>
<summary>8 changes</summary>

- Add built-in playlists for favorites and random tracks (by @OzGav in
[music-assistant#1876](music-assistant/frontend#1876))
- Chore(deps): Bump ludeeus/action-require-labels from 1.1.0 to 2.0.0
(by @[dependabot[bot]](https://github.com/apps/dependabot) in
[music-assistant#1878](music-assistant/frontend#1878))
- Chore(deps): Bump happy-dom from 20.9.0 to 20.10.2 (by
@[dependabot[bot]](https://github.com/apps/dependabot) in
[music-assistant#1879](music-assistant/frontend#1879))
- Chore(deps): Bump marked from 18.0.3 to 18.0.5 (by
@[dependabot[bot]](https://github.com/apps/dependabot) in
[music-assistant#1880](music-assistant/frontend#1880))
- Chore(deps-dev): Bump @types/node from 25.9.1 to 25.9.2 (by
@[dependabot[bot]](https://github.com/apps/dependabot) in
[music-assistant#1881](music-assistant/frontend#1881))
- Chore(deps): Bump @tanstack/vue-form from 1.32.0 to 1.33.0 (by
@[dependabot[bot]](https://github.com/apps/dependabot) in
[music-assistant#1882](music-assistant/frontend#1882))
- Chore(deps): Bump vue-i18n from 11.4.4 to 11.4.5 (by
@[dependabot[bot]](https://github.com/apps/dependabot) in
[music-assistant#1883](music-assistant/frontend#1883))
- Chore(deps): Bump reka-ui from 2.9.8 to 2.9.9 (by
@[dependabot[bot]](https://github.com/apps/dependabot) in
[music-assistant#1884](music-assistant/frontend#1884))
</details>


## 🙇 Contributors

@MarvinSchenkel, @OzGav and @stvncode

Co-authored-by: stvncode <25082266+stvncode@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants