I am using TWindowsMediaPlayer and am facing a problem. After the current song ends, I cannot download it to download a new song and then play it.
procedure TMainWinForm.WMPlayer1PlayStateChange(Sender: TObject; NewState: Integer); begin if (NewState = wmppsMediaEnded) then begin WMPlayer1.URL := FileScanner.SelectSong; writeln('Play triggered on ', String(WMPlayer1.URL)); WMPlayer1.controls.Play; // DOES NOT PLAY THE SONG! end; end;
This downloads the song, but additional user intervention is required to play it. The only way I can continue is to check for wmppsStopped, but this event happens twice, so I get every odd numbered song in the list.
Any ideas on how to make it work correctly?
source share