MusicDelivery only fired once
Kimmen opened this issue · comments
Hi,
I'm playing around with SpotiFire and I've created a small client. But when I run session.PlayerLoad(track), the MusicDelivery event is only fired once. I've tried to set the ConsumedFrames to 0, +1 and Frames.
The part of logging in and search for tracks works perfectly, but not getting music. Seems like I'm doing something wrong. As you see below, I don't do anything strange? (sorry for the syntax coloring the code)
What am I missing? =)
/Joakim.
_spotifyISession.MusicDeliver += (s, e) =>
{
ConsumeData(e.Samples);
e.ConsumedFrames = e.Frames;
} };
var error = _spotifyISession.PlayerLoad(track);
I'm not to certain about the inner workings of libspotify and the events are just a redelivered .NET event for the event fired by libspotify. If you have a look at Spotifire.Server.SpotifireServer.spotify_MusicDeliver you can see a working example using BASS.NET. If you still can't get it to work I'll see if I can create a more simple example.
Also (I just tested locally), there is a timedelay (I had to wait ~15sec for some reason) after the first call to MusicDeliver until the calls started comming regularly. Don't know why this is, and I don't have time to look into it as I have exams in a week.
But I should expect several calls from MusicDeliver, whether I use Bass.net or not?. If it works for you guys, it seems like I need to talk to Spotify directly. Thanks anyway.
Just wrote a small test and this code worked for me:
if (e.Samples.Length > 0)
e.ConsumedFrames = e.Frames;
else
e.ConsumedFrames = 0;
Let me know if you still can't get it to work and I will provide you with a full working sample console application.
That would be great if you could provide an example. Need my mail? It feels like I'm either missing a function call or it' might be some crazy threading problem.