PDA

View Full Version : How do I test for an Internet stream reconnecting?



GoCubs
2007-01-05, 13:28
In the Sirius plugin there are times an Internet stream will crap out for whatever reason. SlimServer then tries reconnecting to the stream over and over again without success because the initial URL expires shortly after it's created.

While attempting to reconnect, Slim::Player::Playlist::song($client) returns the original URL and Slim::Player::Source::playmode($client) returns that the player is in 'play' mode. Is there something I can use to determine if the player is "reconnecting"?

If I can determine it's reconnecting I can stop it from reconnecting, get a fresh valid URL, and start up the stream again.

Thanks
-Greg

andyg
2007-01-05, 13:36
On Jan 5, 2007, at 3:28 PM, GoCubs wrote:

>
> In the Sirius plugin there are times an Internet stream will crap out
> for whatever reason. SlimServer then tries reconnecting to the stream
> over and over again without success because the initial URL expires
> shortly after it's created.
>
> While attempting to reconnect, Slim::Player::Playlist::song($client)
> returns the original URL and Slim::Player::Source::playmode($client)
> returns that the player is in 'play' mode. Is there something I can
> use to determine if the player is "reconnecting"?
>
> If I can determine it's reconnecting I can stop it from reconnecting,
> get a fresh valid URL, and start up the stream again.

Are you sure this isn't the result of the Repeat setting? There's
not currently any code that retries a stream that has failed.

I've got some new code that allows plugins to hook into the Source
flow such as before playback, decoder underrun or underrun to perform
async tasks. It was designed so you could make async API calls when
playback is triggered on a protocol handler, such as live365://, it
would let you do something like get a new session ID for the URL. So
it will be exactly what you're looking for. But this code is still
only in SqueezeNetwork and I have not yet merged it back into the 7.0
code.

GoCubs
2007-01-05, 13:58
Are you sure this isn't the result of the Repeat setting? There's
not currently any code that retries a stream that has failed.

I've got some new code that allows plugins to hook into the Source
flow such as before playback, decoder underrun or underrun to perform
async tasks. It was designed so you could make async API calls when
playback is triggered on a protocol handler, such as live365://, it
would let you do something like get a new session ID for the URL. So
it will be exactly what you're looking for. But this code is still
only in SqueezeNetwork and I have not yet merged it back into the 7.0
code.
Ahhh... You're probably right. The playlist is usually a single item list and I usually have repeat on...

Until I can get a unique session ID for the URL is there a way I can figure out the time length a stream has been playing for? I think that would do the trick as well.

Much thanks
-Greg

andyg
2007-01-05, 14:06
On Jan 5, 2007, at 3:58 PM, GoCubs wrote:

>
> Andy Grundman;167416 Wrote:
>>
>> Are you sure this isn't the result of the Repeat setting? There's
>> not currently any code that retries a stream that has failed.
>>
>> I've got some new code that allows plugins to hook into the Source
>> flow such as before playback, decoder underrun or underrun to perform
>>
>> async tasks. It was designed so you could make async API calls when
>> playback is triggered on a protocol handler, such as live365://, it
>> would let you do something like get a new session ID for the URL. So
>>
>> it will be exactly what you're looking for. But this code is still
>> only in SqueezeNetwork and I have not yet merged it back into the 7.0
>>
>> code.
> Ahhh... You're probably right. The playlist is usually a single item
> list and I usually have repeat on...
>
> Until I can get a unique session ID for the URL is there a way I can
> figure out the time length a stream has been playing for? I think
> that
> would do the trick as well.

Try Slim::Player::Source::songTime($client) although I'm not 100%
sure what this does if the stream has stopped.

GoCubs
2007-01-05, 14:23
Try Slim::Player::Source::songTime($client) although I'm not 100%
sure what this does if the stream has stopped.

Thanks Andy. I should be able to create some fuzzy logic around this...

-Greg