dweymouth / supersonic

A lightweight and full-featured cross-platform desktop client for self-hosted music servers
GNU General Public License v3.0
875 stars 45 forks source link

MPV_ERROR -10 Property Unavailable #401

Closed OliverEricT closed 3 months ago

OliverEricT commented 3 months ago

I recently installed the latest version of supersonic (first install) via the aur supersonic-desktop and I am not able to playback any audio from my ampache server. Most metadata appears to come back, seemingly everything but track ratings. I also added my jellyfin library, but that has no issues and playsback everything perfectly.

I ran the application from the terminal and clicking on a track to play in album view, did not post a log message, nor did clicking a song in the album detail view. When in the now playing , when I click on a song I see the error message

Preferences API requires a unique ID, use app.NewWithID() or the FyneApp.toml ID field

Thank you all in advance for the help.

dweymouth commented 3 months ago

The Preferences API log message is not an issue at all - just Fyne (the UI toolkit) being annoying :/ Are you completely unable to play songs on ampache but it's working fine on Jellyfin? I may need to test some more with an Ampache test server. The MPV_ERROR property unavailable seems to happen intermittently when stopping and playing new tracks, but it shouldn't impact actual playback - if it does there may be an MPV-related bug but I'll likely need to gather more info to know how to respond to it

dweymouth commented 3 months ago

I actually can't reproduce the "Preferences API" log message here on Mac. In any case, if the app is behaving normally it's not a real issue- I am not directly using the Fyne preferences API so I don't know what widget or Fyne API is trying to indirectly use it.

OliverEricT commented 3 months ago

@dweymouth I am terribly sorry, I posted the wrong the error message, below is the error message I originally meant to post.

2024/06/12 11:35:58 error getting playback status: MPV_ERROR -10 property unavailable

I was looking into that fyne error before It seemed like a UI error that was meaningless.

But yes, I am completely unable to playback any track; flac, mp3, or mpa; when I am connected to my ampache library. If I connect to Jellyfin I am able to have playback of any file I've tried.

dweymouth commented 3 months ago

I wonder if you're running into https://github.com/dweymouth/supersonic/issues/91 which I only know of happening with Airsonic(-Advanced). Do you have MPV installed as a standalone program? If so can you check playing tracks directly with MPV as described in that issue? (you will need to find a track ID through the subsonic API, and set your username and password in the &u= and &p= query parameters)

OliverEricT commented 3 months ago

I do have standalone mpv installed, and I ran the step outlined in #91, and it works fine with no issues. The request to my server is a bit different, but I don't think that should make a marked difference in the issue. but in case it does help.

 $  mpv http://ampache.deepthought.local/play/index.php?type=song&oid=2346&uid=1&transcode_to=mp3&bitrate=32000&name=Rancid%20-%20Don%20Giovanni.mp3
[ffmpeg/demuxer] mp3: Estimating duration from bitrate, this may be inaccurate
Audio --aid=1  (mp3 2 ch 44.1 kHz)
File tags:
 Artist: Rancid
 Album: Rancid (2000)
 Date: 2000
 Genre: Punk Rock
 Title: Don Giovanni
 Track: 1
AO: [pipewire] 44100Hz stereo 2ch floatp
A: 00:00:05 / 00:00:35 (16%) Cache: 29s/1MB
Exiting... (Quit) ------ This is me ctrl+c after hearing it playthrough
OliverEricT commented 3 months ago

I followed some of the other issue links in #91 , and I noticed that you have a issue out on sublime-music, which I am also having an issue with, so much so that I ended up dropping it in favor of this application lol.

OliverEricT commented 3 months ago

@dweymouth good morning, I was wondering if you had any other thoughts about the above comment, or is there any other information I could provide?

dweymouth commented 3 months ago

That stream URL you passed to mpv doesn't look like one of the Subsonic stream urls (ie what Supersonic will be passing to MPV) - those look like http://serverbaseurl/rest/stream?id=<trackid>&u=<username>&t=<token>&c=supersonic Can you try to grab a subsonic stream URL and see if that still works with MPV directly? There used to be a log message that Supersonic would print whenever it added a new URL to MPV but it was removed because it was verbose and there is currently no verbose/non-verbose logging system in place. But if you're building from source you could add it back

dweymouth commented 3 months ago

Another thing to try - in the Playback tab of the Supersonic settings dialog, try both with and without the "Disable server transcoding" checked and see if it changes anything

OliverEricT commented 3 months ago

Testing

Ok so I got the endpoint http://<base-url>/rest/stream.view?id=300002273&u=<user>&t=<token>&s=c19b2d&v=1.12.0&c=myapp&p=<password> and went to test with MPV and got the result

Failed to recognize file format

I checked the subsonic api documentation and saw there was a filetype flag and so I set that to both mp3 and raw (raw is noted as being the remove server transcoding option) and I got the same result.

I also tried wget'ing the endpoint and wasn't able to see a body for the request, as a web developer myself I haven't messed with any streaming options so I don't really know what the body of a stream is supposed to look like but I thought I would check it out.

After neither of those worked I opened up postman and was able to get the file to stream, pretty seemlessly actually.

Finally I tried turning off server transcoding in the supersonic settings and got the same result of no playing.

I'm not sure if this is a notable addition but when checking the logs of supersonic, after clicking a file in playback, it outputs the error getting playback status: MPV_ERROR -10 property unavailable 4 times.

Build Locally

I'm not super familiar with the inner workings of makepkg but it seems that it is just a way to build a given application into a bin for arch to use, if that is the case, then I could add that log line back to my local, like you suggested, and then be able to try and debug myself locally?

dweymouth commented 3 months ago

So this does sound like #91 is reproducing with Ampache too as it seems to be the same root cause - there's something weird about the response/file the server is returning in response to the GET http://.../rest/stream?... request that MPV can't recognize. Which unfortunately is a bit out of scope for Supersonic being able to do something about this.. other than moving to a different playback backend than MPV. So the best solution would be to figure out what's weird about with Ampache is returning and open an issue on the Ampache project. (Or maybe you could consider switching to Navidrome?)

For reference - the response to GET http://.../rest/stream?... should just return the file contents in the body (transcoded file if transcoding enabled) along with a standard HTTP header. Here is what Navidrome returns in the header:

curl -s -I -X GET 'http://192.168.1.32:4533/navidrome/rest/stream?u=drew&p=redacted&v=1.15.0&c=foo&id=redacted'
HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Length: 29565456
Content-Type: audio/flac
Last-Modified: Wed, 10 Jan 2024 18:58:05 GMT
Permissions-Policy: autoplay=(), camera=(), microphone=(), usb=()
Referrer-Policy: same-origin
Set-Cookie: nd-player-64726577=14626c6d-674c-4aac-b217-2bcac9a05214; Path=/navidrome; Max-Age=31536000; HttpOnly; SameSite=Strict
Vary: Origin
X-Content-Duration: 223.32
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
Date: Tue, 18 Jun 2024 19:13:51 GMT
dweymouth commented 3 months ago

The property unavailable error is simply because Supersonic tells MPV to start playing the file and then periodically starts polling MPV to retrieve the play time position, and MPV is responding with the property unavailable error.

OliverEricT commented 3 months ago

Yeah with that information I also wouldn't expect you to fix that mpv error.

At this point I think I'll most likely just check out navidrome. I don't remember why now, but there was a reason I sought out something else instead of it, but everything just keeps leading me back to navidrome.

Thank you so much for helping out with this, since this issue is upstream I'm going to mark this chain as closed.

dweymouth commented 3 months ago

Gonic is a fine choice too depending on your needs and is known to work well with Supersonic

dweymouth commented 3 months ago

I am curious though if you run the above curl command on your Ampache URL what they are returning in the header

OliverEricT commented 3 months ago

After spinning up a navidrome container, I remembered the thing that annoyed me was that you cannot edit tags inside of navidrome. Which ultimately is only an issue for me as I've been going through and trying to rate everything in my collection, and apply a tag of some kind to denote albums I'm going to review later. A very niche issue, but an issue for me none the less.

I ran the above curl and this was the output

curl -s -I -X GET 'http://<base-url>/rest/stream?u=admin&p=>pass>&v=1.15.0&c=foo&id=300002273'
HTTP/1.1 200 OK
Server: openresty
Date: Tue, 18 Jun 2024 20:06:56 GMT
Content-Type: text/html; charset=UTF-8
Content-Length: 0
Connection: keep-alive
Set-Cookie: ampache=uk6e8d6sfg60te6dghjndqnof8; path=/; domain=ampache.deepthought.local; SameSite=Lax
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Set-Cookie: ampache=kbh53q1pjge76hdnrl66uk4222; path=/; domain=ampache.deepthought.local; SameSite=Lax
Access-Control-Allow-Origin: *
X-Served-By: ampache.deepthought.local
dweymouth commented 3 months ago

Content-Type: text/html; charset=UTF-8

well, that could be a problem. That should be an audio mimetype, like audio/flac or audio/mp3. Also

Content-Length: 0

If transcoding, it's reasonable to omit that header entirely, but not send 0

Edit: I'm actually not sure what the thing to do for Content-Length when transcoding is, I'll have to check how Navidrome handles it

dweymouth commented 3 months ago

alright here is an example from Navidrome when transcoding:

curl -s -I -X GET http://192.168.1.32:4533/navidrome/rest/stream\?u\=drew\&p\=redacted\&v\=1\&c\=foo\&id\=fooid
HTTP/1.1 200 OK
Accept-Ranges: none
Content-Type: audio/ogg
Permissions-Policy: autoplay=(), camera=(), microphone=(), usb=()
Referrer-Policy: same-origin
Set-Cookie: nd-player-64726577=14626c6d-674c-4aac-b217-2bcac9a05214; Path=/navidrome; Max-Age=31536000; HttpOnly; SameSite=Strict
Vary: Origin
X-Content-Duration: 223.32
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
Date: Tue, 18 Jun 2024 20:19:52 GMT
Transfer-Encoding: chunked
OliverEricT commented 3 months ago

I wonder if part of the issues is that Ampache is using an older version of the subsonic api. it looks like your version is 1.15.0 and mine defaults to 1.12.0.

dweymouth commented 3 months ago

could be a separate issue maybe but the spec for the stream endpoint (for music at least) hasn't changed since version 1.6.0

dweymouth commented 3 months ago

Definitely feel free to reference this issue if you open an issue against Ampache. (And include your server version, etc). I'd title the issue something like "Subsonic API stream endpoint returning incorrect headers" and note that this makes Ampache incompatible with MPV-based clients