Author Topic: How Can I to Cancel Downloading MP3 File When I use Bass.BASS_StreamCreateURL()?  (Read 978 times)

illdilld

  • Posts: 2
private int _Stream = 0;

public void NextSong()
{
    if((_Stream!=0)
    {
      Bass.BASS_ChannelStop(_Stream);
      Bass.BASS_StreamFree(_Stream);  
     // It do not working?... when I click the "nextsong" button, I don't want still downloading the prev song even if Not downloaded
     }
    _Stream = Bass.BASS_StreamCreateURL(Source.ToString(), 0, Flags, null, IntPtr.Zero);
}
« Last Edit: 11 Aug '10 - 18:31 by illdilld »

Ian @ un4seen

  • Administrator
  • Posts: 20600
BASS_StreamCreateURL doesn't download the entire file, but it does wait for the connection to be made and some data downloaded to detect the format/etc. There is currently no way to cancel a BASS_StreamCreateURL call, but what you could do is make the call in a separate thread, and then signal the thread if you would like to cancel it, and the thread can then discard (BASS_StreamFree) the new stream when the call returns.