mirror of
https://github.com/librespot-org/librespot.git
synced 2026-04-27 08:15:50 +03:00
[GH-ISSUE #603] [Question] Why does librespot_playback::audio_backend::find return a None option even if the backend is valid? #377
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#377
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 @Occhioverde on GitHub (Feb 14, 2021).
Original GitHub issue: https://github.com/librespot-org/librespot/issues/603
Hi all!
Maybe I'm about to ask a stupid question, but I really can't find a solution.
The problem is this: I'm trying to write a very simple application that, after receiving the credentials, plays a song from Spotify (whose ID is written directly in the code) but I can not create an instance of Player.
When I try to search the backend using the function
librespot_playback::audio_backend::find, in fact, the program crashes saying it has received a None value. Obviously this would be normal if it wasn't that the specified backend (rodio) was told to be available (I checked the backends using the commandtarget/release/librespot -n test --backend '?'and librespot listed merodio (default),pipeandsubprocess).If it helps, this is my source code:
I am aware that, in all likelihood, this problem is from some error in my code, but I hope someone can help me solve it.
I thank you in advance for your help.
@Johannesd3 commented on GitHub (Feb 14, 2021):
Did you enable the
rodio-backendfeature flag in yourCargo.toml?@Occhioverde commented on GitHub (Feb 14, 2021):
No, I didn't know that was necessary.
What do I need to do to activate it? Pardon the question, but, as you probably noticed, I'm quite new to Rust...
@Johannesd3 commented on GitHub (Feb 14, 2021):
I'm not sure if it's necessary since it should be enabled by default. However, it would be like this:
Does
"pipe"work as backend?@Occhioverde commented on GitHub (Feb 14, 2021):
pipedoes not throw errors, but it does not play audio. From what I understand, however, this is normal due to the fact that pipe generates a stream of data without actually sending it to any backend.As for adding the
rodio-backend, so far I've importedlibrespot_coreandlibrespot_playbackseparately. How can I access them throughlibrespot?@Johannesd3 commented on GitHub (Feb 14, 2021):
Ah, this makes sense,
librespot_playbackdoesn't set default features. Just do the same as I suggested above withlibrespot_playbackinstead.@Occhioverde commented on GitHub (Feb 14, 2021):
Now the program doesn't seem to throw errors anymore, but the playback still doesn't start.
No sound can be heard and the official Spotify apps don't detect connected devices.
@Johannesd3 commented on GitHub (Feb 14, 2021):
The official Spotify apps won't detect your device unless you use the
librespot_connectcrate. Just take a look at the source code of librespot or spotifyd to see how it works.I can't tell you though why there's no playback.
@Occhioverde commented on GitHub (Feb 14, 2021):
Alright, thanks for the help anyway.
At least I solved part of the problem....