arcnmx / MPD

MPD fork adding a youtube-dl plugin
https://github.com/MusicPlayerDaemon/MPD/pull/223
GNU General Public License v2.0
7 stars 2 forks source link

resuming playback sometimes fails #6

Closed arcnmx closed 3 years ago

arcnmx commented 4 years ago

Occasionally a short while after resuming playback, mpd will suddenly skip to the next track. Presumably this happens because the input stream's URL has expired in the time since it was paused. The plugin should be able to detect and recover from these failures - but still be able to bail out on persistent failures of course. mpv seems to have similar logic built in?

Also, move to ProxyInputStream if possible.

Rio6 commented 4 years ago

Hm, I'm thinking of a way to be able to distinguish between expired url vs other failures. Maybe we can make YtdlInputStream to get another url when the inner stream failed, if a certain amount of time has passed?

arcnmx commented 4 years ago

Including any sort of time-sensitive code seems like something to avoid, it will probably be messy. It looks like the expiry time is encoded into the URL (a quick test shows they're valid for 6 hours?), but we can't really count on that...

Maybe if we're lucky it errors out with a sensible status code like 408/410/??? that can be used to trigger a retry?

EDIT: youtube looks like 403 Forbidden once it expires... So if we can't consistently tell then we might have to set up some sort of error counter that's cleared any time a request succeeds / data is received... and retry at least once on failures?

Rio6 commented 4 years ago

Parsing URL/response probably won't work for every single extractors youtube-dl support so probably not the best idea.

I guess a retry counter is the best we can do.

Rio6 commented 4 years ago

I've made YtdlInputStream inhertit from ProxyInputStream in https://github.com/Rio6/MPD/tree/ytdl. I'll add the retry counter later.

Update: the code for retrying is pushed too

Rio6 commented 3 years ago

24 should fix this, although I haven't actually tried pausing a song for a long time. I'll probably do that in the next few days when I remember and see if it works.

Rio6 commented 3 years ago

I paused a song for 11 hours and itstill plays as expected. Let's call this issue done.

BTW, it might be good to do another rebase, we're lots of commits behind again :)

arcnmx commented 3 years ago

Sorry I've been dead for ages, will try to get to that over the next few days. I've been using it all year and am pretty happy with how it's been working! I'll check if there's anything major to update to, and also put up a 0.22.7 branch too.