Posted by Bo JohanssonI have a button and a mediaplayer on a form.
The button have this code (not the mediaplayer button):
procedure TForm1.Button1Click(Sender: TObject); begin MediaPlayer1.Open; MediaPlayer1.FileName:='F:\Min musik\Tractionprojekt\cd_a511040e_trk03.wav'; MediaPlayer1.Play; end;
Nothing happens, nor errors. But if set it up like this:
1. Chose another file in the filename property of the mediaplayer.
2. Click the button.
Now this file plays.
3. I stop it with another button (not a mediaplayer button):
procedure TForm1.Button2Click(Sender: TObject); begin MediaPlayer1.Stop; end;
4. I click the first button. Now the file from the code is playing.
What shall I do in order to play this file the first time. I guess it has something to do with the filename but I don't know what.