LinkPlay Integration

Ok cool, so the best way is to use the custom mini card in conjunction with the Spotify card?

I guess so, but I don’t use Spotify so can’t really tell…

1 Like

Hey Robi

Using your setup with the source buttons, is it possible to have a similar setup but have the buttons call a preset instead of a source?

I have some Spotify and internet radio presets saved, that I can call manually using the linkplay.preset service, but I’m not sure how to incorporate this into a button.

Sorry man, I know I’m asking a lot, but I’m a little new to Lovelace.

It’s in the mini-media-player docs. You can assign a service call to each button.

1 Like

Legend, thanks mate.

Hello everyone. Have experience in integrating products on the a98 module from linkplay?

Hello,
I have tried reading through this thread, but haven’t found it mentioned/solved. When I run the API call “http://192.168.1.4/httpapi.asp?command=getPlayerStatus”, I get a response where “status” is correctly displaying “pause” (and “play” when it is playing). However, in my mini-media-player, both when I have music playing and paused, the “play/pause”-button is displaying the pause action icon.

Screenshot 2021-02-03 at 10.52.40

When I look in Developer Tools, the media_player is showing state as “playing”, both when the API responds with status “pause” or “play”.

I am using two Audio Pro A10:s, and I tried with

hide:
  play_pause: true
  play_stop: false

in the mini-media-player configuration code.

What do you see when you use Lovelace’s default media player?

I see the exact same problem. The play/pause icon always displays the pause icon.

What type of music source are you playing?

Sorry for the late response. I didn’t get any notification, and just happened to look in the thread now. I’m using Spotify, so for example I start Spotify on my iOS/Android device (same behavior), start playing a song and choose “Kitchen” in the list of speakers.

Oh, Spotify is a different kind of thing…

Okay, with what should I be playing audio for this to work?

Plug in a USB with MP3 files.

I have the same setup as andersmoldin (two AudioPro A10) and have the same issue with playing Spotify. Could you elaborate on why it’s different when it comes to displaying the proper playstate in the UI?

It’s not just about displaying, it’s also about controlling it. The Linkplay modules are not coherent on the status display, and I’ve ran into issues pausing streams for longer periods of time.

I make an analogy for better understanding. For example on YouTube there’s no Stop button and state, because their web app stops downloading the stream after you press pause. When you resume, it continues playback from where it was pressed, and starts downloading chunks of data again. So it’s funny but on many streaming services (mostly pre-recorded content streamings) a Pause button really works like a Stop button on an old tape player. The Stop functionality was actually renamed to Pause because when CD players appeared, the Stop behavior changed: it actually “rewinded” the entire content to the beginning, so on a CD player when you press Stop and Play, it starts playing from the beginning, on a tape player when you press Stop and Play, it plays from where you left off, it doesn’t jump/wind back to the beginning.

On a live stream (like a radio broadcast) having Pause actually doesn’t even have any sense since pausing it would require to start caching the entire transmission to local memory, and when pressing Play again it would be able to continue from where it left off (as live streams are not directly cached on servers, their download can’t be resumed from a certain position in time). Of course Linkplay modules don’t have such memory capacity but they still support some kind of pausing of the streams (for a few seconds). This is not limited in any matter so if one actually pauses a stream while playing and forgets it like that, the module runs in a buffer overrun. Some models reboot, some have to be manually rebooted because they crash.
So in such cases when pressing Pause, in reality we need to Stop the playback, to correctly handle the situation. When pressing Play after this, the stream should re-connect and play from the actual position where it is on the server, as it is a live transmission.

On file streaming on the other hand (like Spotify should be) Pause should behave quite like in the YouTube. When pausing the stream, download should stop. This wouldn’t cause any buffer overrun or lockups. Unfortunately, as far as I’ve noticed, Linkplay is not aware of this, it keeps downloading the streams until it locks up or reaches to the end of the track. So here if we Stop instead of Pause, would cause the track to play from the beginning. If we use Pause as normal, it can continue when playing again, as long as the module didn’t crash.

We need to manually handle these kind of issues from within the component - I’m on the half way to finish but nowdays my time is a bit limited.
I’m also planning to rewrite the component to be async, and also to support config flow - these all require quite some time. But I think implementing async should have priority as most part of the component has to be rewritten anyway, and handling specialty cases like various streaming modes should come after that.

3 Likes

Thanks for providing the background information! Looking forward for having this sort of functionality within Home Assistant for Linkplay devices.

A question, if the above buffering is an issue for Linkplay devices how does the 4Stream app solve this? Within the app I can pause a Spotify stream and even after 3 minutes I can press play again and it will simply continue where it left off.

Don’t know yet, have to investigate.

I’m actually getting really frustrated with Spotify using this integration, and I can’t really tell if it’s the Spotify service or the Muzo cobblestones I have. If I pause a stream for more than a few seconds spotify will disconnect from the linkplay devices, and I have to re-select the device in the app. Sometimes a playlist will just stop after a song is over, and the cobblestones become unresponsive requiring a reboot.

I’m actually trying out the Tidal service to see if it works any better than Spotify, and so far so good. We’ll see if this continues.

Yep, that’s a problem in the linkplay firmware imho.