I didn't answer you question because I revised the code and couldn't remember what was there. After going back, at line 507 it is just the start of the thread at
Application.Current.Dispatcher.BeginInvoke(
new Action(() =>
As for the revised code, here it is:
public void OpenUrl(string url)
{
Bass.BASS_StreamFree(stream);
Thread t =
new Thread(
(object o) =>
stream =
Bass.BASS_StreamCreateURL(url, 0, BASSFlag.BASS_DEFAULT, null,
this.Handle)
);
if (stream != 0)
{
// play the stream channel
Bass.BASS_ChannelPlay(stream, false);
}
else
{
// error creating the stream
MessageBox.Show("Stream error: {0}" + Bass.BASS_ErrorGetCode());
}
t.Start(url);
}
private void Start(string url)
{
stream = Bass.BASS_StreamCreateURL(url, 0, BASSFlag.BASS_DEFAULT, null,
IntPtr.Zero);
if (stream != 0)
{
// play the stream channel
Bass.BASS_ChannelPlay(stream, false);
}
else
{
// error creating the stream
MessageBox.Show("Stream error: {0}" + Bass.BASS_ErrorGetCode());
}
}