Author Topic: Resume live playback on live stream  (Read 631 times)

kenumir

  • Posts: 28
Resume live playback on live stream
« on: 23 May '23 - 12:02 »
I start play with:
Code: [Select]
playerHandle = BASS.BASS_StreamCreateURL(STREAM_URL, 0, BASS.BASS_STREAM_AUTOFREE | BASS.BASS_STREAM_BLOCK, null, null);
and play music:
Code: [Select]
BASS.BASS_ChannelPlay(playerHandle, false);
After some time call pause:
Code: [Select]
BASS.BASS_ChannelPause(playerHandle);
Now after some time a resume play:
Code: [Select]
BASS.BASS_ChannelPlay(playerHandle, true);and is ok, start play on last position

Question is, ho to start play live, go to end of buffer position?
I try:
Code: [Select]
BASS.BASS_ChannelSetPosition(playerHandle, 0, BASS.BASS_POS_END);
BASS.BASS_ChannelPlay(playerHandle, true);
But not working. How to make this?

Ian @ un4seen

  • Administrator
  • Posts: 26083
Re: Resume live playback on live stream
« Reply #1 on: 23 May '23 - 13:48 »
That BASS_ChannelSetPosition call will just tell BASS to end the stream at its normal position, ie. it resets the BASS_POS_END setting.

You can use the BASS_POS_DECODETO flag in that call instead to skip ahead, but note it isn't generally safe to pause a live stream because the download will stall once the download buffer (see BASS_CONFIG_NET_BUFFER) is full, and some data may be missed in the meantime and the connection may eventually timeout. To avoid such issues, you could mute the stream instead of pausing it, by setting BASS_ATTRIB_VOL to 0 via BASS_ChannelSetAttribute. Another option is to free the old stream and call BASS_StreamCreateURL again to reconnect.