Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GarminSdkError::NETWORK_REQUEST_TIMED_OUT with Navidrome (subsonic API) and Forerunner 265 #89

Closed
tsdh opened this issue Dec 9, 2023 · 14 comments

Comments

@tsdh
Copy link

tsdh commented Dec 9, 2023

Hi, I'm trying to get SubMusic working with my Forerunner 265 watch and the Navidrome music server which is subsonic API compatible. I've set up the navidrome server which serves on port 4533.

When I visit http://thinkpad-t440p:4533 (thinkpad-t440p is my laptop's hostname which is reachable from my home wifi) with a browser, e.g., from my laptop itself or from a phone which is also in the local wifi, I'm presented with the navidrome login screen where I type user/password and then get into the main menu where I can see my music collection and start listening. So I think the server and network are correctly setup.

So now in SubMusic I've tried these settings:

  • API backend: Subsonic API
  • Server Address: http://thinkpad-t440p:4533 (also with /app or /rest or /app/rest)
  • Username/password: the same I give on the web login screen
  • Authentication method: HTTP Basic
  • Enable Skip: no
  • Enable Debugging: no (also tried with yes)

Whenever I try "Test Server" in SubMusic's More menu, I get the error GarminSdkError::NETWORK_REQUEST_TIMED_OUT.
Checking the Navidrome logs suggests that the SubMusic request never get to navidrome...

@memen45
Copy link
Owner

memen45 commented Dec 9, 2023

Probably you need to set up your server using the default port (80/443). And most likely you also need proper https certificates.

Also note that authentication method should be API, unless you have some custom http server settings!

@tsdh
Copy link
Author

tsdh commented Dec 9, 2023

Ok, so now I have set up nginx as a reverse proxy so that https://thinkpad-t440p/navidrome forwards to http://thinkpad-t440p:4533/navidrome where /navidrome is set as BaseUrl which is required for operation through a reverse proxy.

It works just fine on my laptop or on my phone (well, I have to accept to the risk of trusting the self-signed certificate). Unfortunately, after setting up https://thinkpad-t440p/navidrome in SubMusic (and also choosing API authentication), I still get the same error. Again, it seems that no request makes it to navidrome.

EDIT: The nginx access logs also indicate the request from SubMusic doesn't even appear there...

@memen45
Copy link
Owner

memen45 commented Dec 9, 2023

You cannot use self-willed certificates on most watches. The watch software will not connect!

@tsdh
Copy link
Author

tsdh commented Dec 9, 2023

I see. Well, I have a public virtual server with LetsEncrypt certificate. I guess I should probably move navidrome there... I'll report back.

@tsdh
Copy link
Author

tsdh commented Dec 9, 2023

Ok, that works!
Thanks a lot for your help, @memen45! :-)

@tsdh tsdh closed this as completed Dec 9, 2023
@memen45
Copy link
Owner

memen45 commented Dec 9, 2023

Great to see you got it working! Hope you enjoy SubMusic :)

@tsdh
Copy link
Author

tsdh commented Dec 9, 2023

Oh well, now I have playback issues. Some songs play normally, others get skipped, at least one breaks the watch meaning it's just black screen, no reaction to any button, heart rate sensor still flashing, so not off. All I can do is hold the light button until the watch reboots.

All music files are m4a files with 97kbps bit rate.

Navidrome can transcode to AAC, mp3 or Opus audio with a configurable max. bitrate. Can you give an advice which format is known to work well with Garmin watches in general?

@memen45
Copy link
Owner

memen45 commented Dec 9, 2023

The supported mime types are handled here:

https://github.com/memen45/SubMusic/blob/master/source%2FUtils.mc#L79

M4a, mp3 and AAC/adts should be supported. Mp3 is the safest bet always, as e.g. m4a is not always supported. SubMusic currently does not force transcoding to mp3. Some servers do not support transcoding at all.

You can always check in the playlist overview if a playlist shows 'needs sync'. This could indicate you have unsupported file types in your playlist. Typically, if a file type is not supported, the download is skipped. However, there might be bugs in the Garmin software leading to a completed download and Media error later on.

I will check the crash logs later. Could you create a new issue if the problem persists?

@tsdh
Copy link
Author

tsdh commented Dec 10, 2023

How could I get those crash logs? If they were still there, I would open a new issue with them for sure.

That said, I've "removed data" in the storage settings in the mean time because I didn't want to have files there which can crash the watch. I've also updated my music library to serve FLAC instead of m4a. Those seem to play correctly (only very briefly tested for now) but of course they are huge. But given that's a lossless format, I can then try putting a transcoder in between without having too bad quality. (After using an mp3 encoder with the m4a files, there was some stuttering in some songs...)

@memen45
Copy link
Owner

memen45 commented Dec 10, 2023

Sounds like the m4a files are not completely reliable indeed. Converting to mp3 is a good solution. In theory, SubMusic could support forced transcoding by adding a setting transcoding: [off, mp3, m4a, AAC, Wav, flac]. That way you would not have to convert al the files manually. This could be a nice feature request!

Obtaining the crash logs on the device is quite difficult, but I can check all crash logs from here as well!

@memen45
Copy link
Owner

memen45 commented Dec 10, 2023

Just checked the error logs and the only thing I find for your device is an Out of Memory error. Could it be that you have very large files in your playlists or just a lot of songs in a single playlist? The Subsonic API is somewhat limited, as it does not support paged requests. Therefore, the practical limit is around 20 songs per playlist, depending on the amount of metadata.

@tsdh
Copy link
Author

tsdh commented Dec 11, 2023

Oh, indeed! The music I'm listening to has usually pretty long tracks. My navidrome is backed by FLAC files which are about 50MB per track on average. I've set navidrome to transcode to mp3 if the requesting client is SubMusic. However, I don't know how I can test if that works. In SubMusic, I see no way to check what file format the downloaded songs have... Any hint?

I've had many media errors during sync which I could fix by removing songs from the playlist. That way, my first theory was that SubMusic couldn't handle tracks with non-ascii characters in the titles because those where the ones I've tried removing first. But I guess that was plain wrong and removing any random titles would have worked fine. I've read about the 25 songs limit somewhere here but took that number literally, i.e., as a numeric restriction, not something having to do with request/response size.

Out of curiositiy: how can you see my logs? Is there some central SubMusic backend somewhere? That also seems required for #90 because the watch surely has not enough power to transcode there, I guess.

@memen45
Copy link
Owner

memen45 commented Dec 11, 2023

I've set navidrome to transcode to mp3 if the requesting client is SubMusic. However, I don't know how I can test if that works. In SubMusic, I see no way to check what file format the downloaded songs have... Any hint?

That will probably not work, as SubMusic will look at the song metadata to determine the file type to request. If the mime type in the metadata is flac, it will request flac. And if the server responds with a different content header than requested e.g. audio/mpeg, the response will be filtered by the watch software.

Out of curiositiy: how can you see my logs? Is there some central SubMusic backend somewhere? That also seems required for #90 because the watch surely has not enough power to transcode there, I guess.

Not yet. Maybe in the future. Crash logs are collected by Garmin, only the error type, stack trace, device type and time of occurrence are recorded.
Transcoded files can be requested through the Subsonic API (and also the other APIs), so the transcoding will occur on your server. However, this is currently not the default, as Nextcloud servers do not support transcoding and always return the raw file.

@tsdh
Copy link
Author

tsdh commented Dec 11, 2023 via email

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

No branches or pull requests

2 participants