michaelherger / Spotty-Plugin

A Spotify plugin for the Lyrion Music Server (fka. Logitech Media Server) and Squeezebox compatible players
104 stars 20 forks source link

Spotty plugin, spotty behaviour, tracks stop, restart, skip etc #82

Open 80081 opened 1 year ago

80081 commented 1 year ago

Firstly thanks for your efforts with Spotty Michael, I do have an annoying issue though. I use LMS on an Unraid server, with piCore Player on Raspberry Pi 4's for multi room audio. Listening to any locally stored music works fine as does radio etc, but I'm far more interested in Spotify since that's what I use more than anything else.

I've just never managed to get it working reliably, I understand Spotify connect has issues that are difficult to resolve so I don't use that, I just use material skin theme and a tablet to control the audio. Every time I play something from Spotify it will work for a few minutes and stop playing, the player doesn't show as if it's paused it just stops playing, usually if I wait for a minute or so it will carry on, or I can move the track playback bar or skip track and it will start again straight away. It doesn't always do this, sometimes it just skips a track half way through, other times it goes back to the beginning of the current track. I have a Spotify family account, so Spotty has it's own login that nothing else uses.

Any ideas what might be the issue, I've looked through the logs and I can't see anything obvious, in fact it doesn't even look like anything gets logged when these things happen.

michaelherger commented 1 year ago

Did you check your server.log for any hint about spotty failures?

80081 commented 1 year ago

'Any ideas what might be the issue, I've looked through the logs and I can't see anything obvious, in fact it doesn't even look like anything gets logged when these things happen.'

Yeah I've checked the main LMS logs, might there be other logs on the piCorePlayers?

michaelherger commented 1 year ago

Please increase the log level for plugin.spotty to INFO (see Settings/Advanced/Logging), play a track until it stops, then provide me with the full server.log.zip (https://www.dropbox.com/request/T3RctyzGgNg0oFDubq6a).

Scheeringa1 commented 1 year ago

Same issues here. I'm really curious to follow this thread.

80081 commented 1 year ago

server.log.zip

Sorry it took a while, server log attached, I probably had the logging level set too high initially so there's probably a lot of noise. But I can't see any obvious errors relating to my issue.

80081 commented 1 year ago

server.log

Attached a less noisy log from today:

Playback stopped at 10:49 for about a minute Playback stopped at 10:51 for about a minute Track skipped at 11:14

Playback stopped quite a few more times between 10:51 and 11:14 but I wasn't in a position to record the time. Happened many more times after 11:14, but by this time I was busy downloading the log file.

I can't see any obvious issues in the log, it doesn't even look like anything related to this issue is logged. Purge Audio cache seems to line up with the approximate times though?

Scheeringa1 commented 1 year ago

Was anything ever figured out with this? I'm about to say that Spotty here is unusable due to the constant stopping and skipping. It seems to be due to a timing issue between the app and the plugin.

michaelherger commented 1 year ago

No news, I'm sorry.

80081 commented 1 year ago

I haven't found a solution, but I can now say it is almost certainly an issue with the plugin/LMS as opposed to with Spotify. I switched over to Music Assistant which replaces/emulates LMS and has a Spotify integration using Librespot under the hood, it works flawlessly, so presumably the issue is with Spotty plugin or LMS or some combination of both.

michaelherger commented 1 year ago

Yes, it's definitely a problem with the Spotty plugin/LMS: both LMS and Spotify assume themselves to be in control of the playback, and this has to somehow be synced. Eg. if you press play in Spotify, you'd have to tell LMS to play - and vice versa. But then you have to make sure you don't end up in a loop. Or Spotify would think the track has fully been played when the streaming data has all been consumed. But LMS does buffer the audio data all at once, as quickly as possible. This would leads Spotify to change track within seconds. And so on, and so forth. Two controllers is one too many.

So if you don't need LMS for your purposes then there definitely are better solutions to play Spotify.

And fun fact: Spotty uses librespot, too.

80081 commented 1 year ago

And fun fact: Spotty uses librespot, too.

That's why I mentioned it, a similar solution using the same library under the hood doesn't have the problem, which tells me the issue is specific to LMS/Spotty.

LMS and Spotty were a perfectly fine solution for my needs, I don't want to be overly critical especially since you've clearly put a considerable amount of effort into the plugin, but as Scheeringa1 said the constant stopping etc unfortunately makes it unusable for me.

yite2 commented 9 months ago

Hi. I'm having the same issue. I have another log I can share. I hope it may help:

I truncated everything leading up to the play stoppage. But the song is playing and the song information keeps repeating.

At line Item 29 a bunch of stuff happens that is abnormal Then at Line Item 62 for some reason it pulls up another metadata log2.txt

Then it goes back to the correct metadata At Line Item 84 it goes to a third metadata Then it fixes itself and play continues.

Thank you

AndyGOBrien commented 8 months ago

Hey! Any news on this? I imagine this is a tough one to solve. Any ideas?

michaelherger commented 8 months ago

You would have heard if there were 😞.

Scheeringa1 commented 8 months ago

I actually switched from LMS to HiFiBerry. All I was using Logitech for was to stream music to my pi's....so switching made sense for me.

yite2 commented 8 months ago

I actually switched from LMS to HiFiBerry. All I was using Logitech for was to stream music to my pi's....so switching made sense for me.

Does the HiFiBerry OS work directly with spotify? I thought you still needed a server application to send music to a HiFiBerry device?

My setup is using LMS on an UNRAID server. The LMS casts music to a HiFiBerry device I have. My problem is trying to cast music via the Spotty Plugin via LMS.

How is your HiFiBerry setup? Maybe I will be able to do something similar.

80081 commented 8 months ago

I actually switched from LMS to HiFiBerry. All I was using Logitech for was to stream music to my pi's....so switching made sense for me.

Does the HiFiBerry OS work directly with spotify? I thought you still needed a server application to send music to a HiFiBerry device?

My setup is using LMS on an UNRAID server. The LMS casts music to a HiFiBerry device I have. My problem is trying to cast music via the Spotty Plugin via LMS.

How is your HiFiBerry setup? Maybe I will be able to do something similar.

What are you using for playing? I'm using raspberry pi's with an amp hat, running picore player. I'm on an unraid server, running music assistant on the server and it works flawlessly for me.

yite2 commented 8 months ago

I'm using the same setup with a raspberry pi/amp hat/picore player. I'm not familiar with music assistant on UNRAID. I couldn't find it in the APP store.

But good news. I just updated the spotty plugin v4.9.1 on my LMS server and I haven't had this issue since. I'm hoping that it's been fixed. So thank you very much. I'll report back if I have any issues.

Scheeringa1 commented 8 months ago

I actually switched from LMS to HiFiBerry. All I was using Logitech for was to stream music to my pi's....so switching made sense for me.

Does the HiFiBerry OS work directly with spotify? I thought you still needed a server application to send music to a HiFiBerry device?

My setup is using LMS on an UNRAID server. The LMS casts music to a HiFiBerry device I have. My problem is trying to cast music via the Spotty Plugin via LMS.

How is your HiFiBerry setup? Maybe I will be able to do something similar.

HiFi Berry OS uses Vollibrespot as its Spotify connect backend. I loose the ability to stream to all my devices simultaneously which is a bummer.....but overall seems more robust that LMS ever was.

I haven't looked recently, but I didn't really have much luck finding a good solution for multi room audio. Actually, at the time I was using YouTube music and signed up for Spotify because finding YouTube music support was damn near impossible.

Scheeringa1 commented 8 months ago

I actually switched from LMS to HiFiBerry. All I was using Logitech for was to stream music to my pi's....so switching made sense for me.

Does the HiFiBerry OS work directly with spotify? I thought you still needed a server application to send music to a HiFiBerry device? My setup is using LMS on an UNRAID server. The LMS casts music to a HiFiBerry device I have. My problem is trying to cast music via the Spotty Plugin via LMS. How is your HiFiBerry setup? Maybe I will be able to do something similar.

What are you using for playing? I'm using raspberry pi's with an amp hat, running picore player. I'm on an unraid server, running music assistant on the server and it works flawlessly for me.

Music Assistant? First I'm hearing of this! I also run an unraid server. Is music assistant in a docker, or a VM? Home Assistant has media support, but I haven't had time to mess with it. My hardware is a Unraid server running in the backend, and a total of 3 Raspberry Pis with amplifier hats. One powering some marine speakers under my soffit on the front porch, one powering some loudspeakers for the backyard, and the 3rd powering some bookshelf speakers in the garage (what started this entire project) HiFi Berry OS takes the server out of the equation all together, and I found no further use for LMS since switching so I completely uninstalled its docker. IMG_20231018_074823

yite2 commented 8 months ago

I'm using the same setup with a raspberry pi/amp hat/picore player. I'm not familiar with music assistant on UNRAID. I couldn't find it in the APP store.

But good news. I just updated the spotty plugin v4.9.1 on my LMS server and I haven't had this issue since. I'm hoping that it's been fixed. So thank you very much. I'll report back if I have any issues.

Okay I was wrong. It's not fixed. But the update appears to have helped. The pausing and stopping is occurring less but it is still occurring.

yite2 commented 7 months ago

I've been playing around with settings and I think I've improved my experience. I went to my online spotify account and "Remove Access" from all of devices. I logged back on to Spotty on LMS. I turned off "Autoplay similar content" and "Spotify Connect in background" on all of my devices (i.e. cell, desktop app). I think my pausing occurrences are less frequent. I'm wondering if the pausing or skipping has to do with multiple spotify end points/devices updating/connecting and triggering a "continue playing" command. I don't know if this a thing or not. Is there a way for Spotty on LMS to also have settings for "Autoplay similar content" and "Spotify Connect in background".

I do love the app and appreciate your continued support.

One last question: under advanced settings it says: "Please don't change the following settings, unless you know exactly what you're doing ..." I haven't changed any settings and they are all unchecked. Should I have any of these checked?

Thank you

michaelherger commented 7 months ago

I'm not familiar with the Spotify Connect in Background option. Where would I find that? Multiple devices accessing Connect is not allowed by Spotify. So connecting to another device would indeed stop playback in Spotty.

As for those advanced settings: they each deal with very specific issues. The random stopping isn't one of them. I'd leave them unchecked.

yite2 commented 7 months ago

The phone app has a setting that says to allow Spotify to run in background. I'm not sure if it's an option elsewhere. That's probably only a phone thing. It sounds like it would be on an individual level to make sure other devices aren't connecting and probably something you can't control at the endpoint.

I have seen a great improvement since turning off those settings.

michaelherger commented 7 months ago

iPhone or Android? Can't find the background setting on my iPhone's app.

yite2 commented 7 months ago

Android.

Settings>Devices>Spotify Connect in background

"Allow Spotify Connect to keep Spotify running when the app is in background"

zortnac commented 7 months ago

I've been having similar problems when controlled through a native mobile or OSX Spotify app. I get the best results when I make sure that none of my native apps are running on my local network and I use Spotify's web player, but even then playback occasionally stops, though mostly at the end of a track.

I have a Raspberry PI (running Squeezelite) connected to a Marantz processor so I can treat my TV room like an LMS player. Spotify can see both devices, Squeezelite and the Marantz, and if have Spotify play to the Marantz directly there are zero issues.

106382 commented 5 months ago

Hi there, I have a very basic understanding of my LMS/piCorePlayer setup (set up for me by someone else!) and hoping to get some guidance. Until recently, I was able to play music either via the Spotify app on my phone (piCorePlayer would appear as a speaker in the device menu), or via the Spotty plugin. Both worked fine, though I did occasionally experience the stop/start/skipping issues described in this thread. I found it irritating but manageable! However piCorePlayer has now disappeared from my Spotify app available devices list. Do you know why that would be? And is there anyway of getting it back? While I am happy to control via the Spotty plugin, the Spotify app speaker option was particularly useful to allow friends and guests to control the music occasionally! Thanks in advance for any advice to this novice.

michaelherger commented 5 months ago

Check Settings/Advanced/Spotty in LMS: you have to enable Connect mode per player.

106382 commented 5 months ago

Thanks Michael! I just checked and it was already enabled. I’ve tried deselecting, reselecting and restarting LMS just in case, but still not seeing it! Are there any other settings I should look at?

michaelherger commented 5 months ago

Make sure both your mobile device and LMS are in the same network. Can you share a screenshot of the "Advanced Settings" section?

106382 commented 5 months ago

Ah! I have just unchecked the box for:

Don't announce Squeezebox players running in Spotify Connect mode in your network.

and now piCorePlayer shows up on Spotify again, and is playing fine.

Do these settings look ok to you now? Spotted your warning to not change any settings unless you know exactly what you’re doing!

DA5121DA-56AF-4124-A714-7F3136D1B7AE

michaelherger commented 5 months ago

I'd disable the top two, too. In particular the first can cause more harm if you don't really need it (most don't).

106382 commented 5 months ago

Thanks so much Michael, have disabled them too. All working well now!