mirror of
https://github.com/librespot-org/librespot.git
synced 2026-04-27 08:15:50 +03:00
[GH-ISSUE #1515] Spirc task not working in spawn task? #685
Labels
No labels
A-Alsa
SpotifyAPI
Tokio 1.0
audio
bug
can't reproduce
compilation
dependencies
duplicate
enhancement
good first issue
help wanted
high priority
imported
imported
invalid
new api
pull-request
question
reverse engineering
wiki
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/librespot#685
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @GChalony on GitHub (Jul 9, 2025).
Original GitHub issue: https://github.com/librespot-org/librespot/issues/1515
I'm using librespot as a library for a player I've developping (which reads NFC tags and plays the corresponding music). This works fine, but I tried to refactor the code so that I can control the playback with buttons on the box. I moved the logic to a
tokiotask, and nothing happens anymore. The player is not playing any music, nor pausing / skipping to the next song.To make it clearer, here is the code that works
And here is what I have tried:
In the background, the
music_playeris just delegating to a Spirc instance (callingload,next,play_pause). Thespircis created inMusicPlayer::new(), and thespirc_taskis spawn there too. I'm really confused, but I'm thinking that the spirc might not be working in this context ? Do you have any idea ?Thanks a lot !
@photovoltex commented on GitHub (Jul 10, 2025):
Please provide the code part where you spawn the
spirc_task. Without it, it's just guessing in the dark which wouldn't be much of a help.@GChalony commented on GitHub (Jul 10, 2025):
Sure, here is the constructor:
@photovoltex commented on GitHub (Jul 14, 2025):
Hmm, I tested your issue with the
play_connect-example by replaying thespirc_task.awaitwith the following, which seems to work just fine.My test is based on the latest dev version. Which version did you use?
But from everything provided I don't see any obvious issue when handling the
spircand the correlatingtask. There maybe something wrong with yourtokiosetup?@photovoltex commented on GitHub (Jul 15, 2025):
I think the best way forward would be if you could provide a minimal version of your issue to us. The easiest way would be to check in the minimal version on github and share the link to it. Then we can maybe help you, otherwise this issue seems out of our control. (At least from my perspective currently)
@GChalony commented on GitHub (Jul 17, 2025):
Thanks for answering and sorry for the delay. I was using the
devbranch, at commit11c3df8eb1. I will pull again, then try to reproduce the issue from theplay_connectexample.I'm just not sure when I'll be able to test this (holidays), I'll keep you posted.
Thanks for your help
@GChalony commented on GitHub (Aug 2, 2025):
Just tested, it works correctly when running the
play_connectsample with the modification you suggested. It does play / pause without any issue. I'll dig a little more when I have time. Do you know what I could look for in the logs to know if the requests are received ?@roderickvd commented on GitHub (Aug 3, 2025):
Turning this into a discussion, as I don't believe it's an issue with librepot.