Author Topic: Stopping playback when there is a temporary lack of internet  (Read 136 times)

marciod

  • Posts: 9
As the phone switches from WiFi to mobile cellular data, stream playback stops.
In Windows, if the Internet connection is interrupted for a moment, the stream playback also stops.
Is there any way to fix this?

Ian @ un4seen

  • Administrator
  • Posts: 25059
If you're streaming a file, and using BASS 2.4.17, then BASS should automatically try to reconnect and resume the download. BASS can't do that with a Shoutcast/Icecast/similar stream because there's no way to ask the server to resume from a certain position (ie. where the connection was lost). So in that case, you would need to reconnect yourself by calling BASS_StreamCreateURL again. You can set a BASS_SYNC_DOWNLOAD sync (via BASS_ChannelSetSync) to be notified when the connection closes.

marciod

  • Posts: 9
Thank you so much for the quick and helpful response as always :)

marciod

  • Posts: 9
I have one more question.
For META I set:
BASS_ChannelSetSync(FStream, BASS_SYNC_META, 0, @BASSSyncMeta, Self);
And I read:
if GetTags(BASS_TAG_META, LTags) then
...
For DOWNLOAD I set:
BASS_ChannelSetSync(FStream, BASS_SYNC_DOWNLOAD, 0, @BASSSyncDown, Self);
What command to read the download status?

marciod

  • Posts: 9
The question is no longer valid :)

Ian @ un4seen

  • Administrator
  • Posts: 25059
Good to see that you appear to have already found the answer, but in case anyone else has the same question, the download/connection status is available from BASS_StreamGetFilePosition with mode=BASS_FILEPOS_CONNECTED.