I have implemented a music player and I would love to know when a song is actually ended so I can play the next track. Here is my code:
private void BttnPlayClick(object sender, EventArgs e)
string filePath = GetTrackPath();
long streamLength = 0;
streamLength = Bass.BASS_ChannelGetLength(_audioPlayer .Stream ) - 1;
streamLength, new SYNCPROC(OnTrackEnding), IntPtr.Zero);
private void OnTrackEnding(int handle, int channel, int data, IntPtr user)
When I run this code, and when the track is ended, I get this NullReferenceException :
System.NullReferenceException was unhandled
Message: Object reference not set to an instance of an object.
Can someone tell what's wrong?