如何得知mediaplayer播放已经完成?(50分)

  • 主题发起人 主题发起人 microluck
  • 开始时间 开始时间
M

microluck

Unregistered / Unconfirmed
GUEST, unregistred user!
Note: before running this example, initialize the Notify property of TMediaPlayer1 to True.

const

ModeStr: array[TMPModes] of string = ('Not ready', 'Stopped', 'Playing', 'Recording', 'Seeking', 'Paused', 'Open');

procedure TForm1.MediaPlayer1Notify(Sender: TObject);

begin

with Sender as TMediaPlayerdo

begin

Form1.Caption := ModeStr[Mode];
{ Note we must reset the Notify property to True }
{ so that we are notified the next time the }
{ mode changes }
Notify := True;
end;


我查看了帮助中的这个例子,可是奇怪的是:
当播放时,没有任何显示,反而是
第一次播放完成时显示playing
第二次播放时也显示playing
就是不知如何取得stopped状态,请各位指点
谢谢:-)
 
Notify 默认为 false;

procedure TForm1.FormCreate(Sender: TObject);
begin

mediaplayer1.Notify :=true;
end;



Indicates the state of the currently open multimedia device.

type TMPModes = (mpNotReady, mpStopped, mpPlaying, mpRecording, mpSeeking, mpPaused, mpOpen);
property Mode: TMPModes;

Description

Mode specifies the current state or mode of the currently open multimedia device.

The TMPModes type defines the modes for a multimedia device used with a TMediaPlayer.

The following table lists the possible values for of the TMPModes type:

Value Mode

mpNotReady Not ready
mpStopped Stopped
mpPlaying Playing
mpRecording Recording
mpSeeking Seeking
mpPaused Paused
mpOpen Open
 
你讲得不全, 我试了,也不行.
不过用别的办法解决了.
谢谢
 
可以用MediaPlayer1.Position
比如先播放,播放完后看i:=MediaPlayer1.Position的值。
下次检测当j=i时表示播放完毕。
 
后退
顶部