jeffvli / sonixd

A full-featured Subsonic/Jellyfin compatible desktop music player
GNU General Public License v3.0
1.86k stars 73 forks source link

ALAC Files Not Streaming #158

Open TinDefacto opened 2 years ago

TinDefacto commented 2 years ago

Describe the bug Most of my Jellyfin library consists of ALAC files (since I use iTunes at home), and none of those will play via Sonixd. (Other file formats play just fine.) I click "play" and the song comes up as playing, but there's no sound and the progress bar stays at 0:00. I've even configured Jellyfin to transcode all songs, but it's been to no avail. (For what it's worth, I'm running Mac OS Big Sur.)

To Reproduce Steps to reproduce the behavior:

  1. Have an ALAC file (in an .m4a container) on your Jellyfin server
  2. Attempt to stream it via Sonixd

Expected behavior The files to play without error.

Desktop (please complete the following information):

jeffvli commented 2 years ago

Transcoding is currently forced off for Jellyfin on Sonixd since someone was having issues with songs being transcoded by default in #108. I'll add some options to change it.

jeffvli commented 2 years ago

Added a new toggle under the Player settings to allow transcoding. Will be available in 0.11.0.

image

TinDefacto commented 2 years ago

Fantastic; thank you so much!! :) Looking forward to it!

TinDefacto commented 2 years ago

Hi! Unfortunately, even with the update and the transcoding turned on, sonixd still doesn't seem to be playing any ALAC files (though the in-browser Jellyfin site properly transcodes and plays it). In fact, rather bizarrely, Jellyfin doesn't even seem to be registering that the file is attempted to be played -- if I listen to a song I have as an .mp3, it will show on the Jellyfin dashboard that sonixd is playing it, but will not reflect any attempted plays of an ALAC file. (Before this update, it would say it was playing fine on the dashboard when in fact it was not.) Please let me know if you need any more information from me -- I'd love to use this wonderful app!

jeffvli commented 2 years ago

@TinDefacto If possible, could you send me an ALAC-encoded album that I can test? I'm currently getting mixed results from files that I've found online and I think it's better if I get it from someone who's more familiar with it.

I have discord / matrix servers linked on the github readme if it's easier to send it directly.

TinDefacto commented 2 years ago

Sure thing! Trying to join the Discord, but I can't find it in the readme, and the link on the v0.11 release doesn't seem to work anymore.

jeffvli commented 2 years ago

Sorry about that, the discord link is fixed in the v0.11.0 release page now.

jeffvli commented 2 years ago

Started taking a look at this again with the ALAC files you provided me.

Seems like transcoded files are handled a bit differently on Jellyfin than from Subsonic's API, and may not be as simple as providing the audio URL. (Also ALAC transcoding seems to fail on Jellyfin 10.8.0 Alpha 5 even on the web UI).

From what I can see from looking at the network requests on the Jellyfin web UI:

  1. A HEAD request is sent to the Universal Audio endpoint
  2. A GET request is sent to the Universal Audio endpoint
  3. A GET request is sent to the Audio endpoint to retrieve main.m3u8 (that returns the list of transcoded chunks?)
  4. The HTML5 audio tag src is set to a blob url blob:http://server:port/guid (e.g. blob:http://192.168.14.11:8096/9b86d4ce-1d6c-4eaa-bc37-25a043187005)
  5. Multiple GET requests occur for each of the transcoded chunks output by step 3

I'm currently attempting to take a look at how jellyfin-vue and jellyfin-client-axios are handling transcoded audio. I may need someone who is intricately familiar with how Jellyfin handles audio transcoding to clear up how to properly play transcoded audio from the audio tag.

didaktiik commented 2 years ago

I can confirm ALAC files are unplayable right now even with transcoding enabled :-)

stefan1983 commented 2 years ago

Hi guys, I ran into the same. Since my music archive also consists of 90% of ALAC files, I can play only a few tracks at the moment.

I really like the app and project, it has a nice interface and everything one would expect / need (even gapless playback! 🙌🏻) for a proper macOS music app.

Hope there will be solution soon.

Thanks

stefan1983 commented 2 years ago

What is the goal here then, trying to allow / enable ALAC support at all or to properly transcode ALAC to anything else?

jeffvli commented 2 years ago

Well.. I definitely spent way too long figuring out how to actually play the transcoded files.

So apparently Jellyfin returns an hls stream as a m3u8 playlist from the audio endpoint, which is not compatible with the html5 <audio> tag. That means my current player implementation doesn't work. I need to introduce a separate headless video player component that can handle the hls stream and swap to it when the song requires transcoding.

Going to see if I can get this working for the new version.

angsanley commented 1 year ago

Any updates on this issue? I'm still having this issue right now

jeffvli commented 1 year ago

@angsanley Unfortunately it's a limitation of the player that Sonixd uses: react-audio-player.

The rewrite solves it by using mpv or alternatively react-player which I may port back to Sonixd eventually.

stefan1983 commented 1 year ago

I tested it successfully today with ALAC files (via Navidrome) and Feishin (via MPV).

Works great