在线等候一小时,关于mdeiaplayer事件

tresss 2003-01-03 07:42:23
有没有人能够提供mediaplayer的实例.
我要实现的功能是在播放完一首歌后,可以自动播放列表中的下一首歌.

请写出代码!!
...全文
75 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
gxh973121 2003-01-04
  • 打赏
  • 举报
回复
在mediaplayer1的onNotify事件中写:
if (mediaplayer1.mode=mpStopped) and
(mediaplayer1.NotifyValue=nvSuccessful) then
  • 打赏
  • 举报
回复
我的思路是:

判断当前的position,,如果是最后就下一首歌,,
  • 打赏
  • 举报
回复
楼上的高手,如果是用户按停止按钮后呢??您想想,,
Billy_Chen28 2003-01-04
  • 打赏
  • 举报
回复
//双击文件列表框,选择开始播放的歌曲
procedure TForm1.FileListBox1DblClick(Sender: TObject);
begin
MediaPlayer1.FileName :=filelistbox1.FileName ;
MediaPlayer1.Open ;
MediaPlayer1.Notify :=true;//关键之处:该属性设为true 让MediaPlayer1成功调用
//play方法之后能够响应ONNotify事件
MediaPlayer1.play;
end;

//当一首歌曲播放完成时,响应如下事件
procedure TForm1.MediaPlayer1Notify(Sender: TObject);
begin
if filelistbox1.ItemIndex<filelistbox1.Items.Count then
begin
filelistbox1.ItemIndex:=filelistbox1.ItemIndex+1;
MediaPlayer1.FileName :=filelistbox1.FileName ;
MediaPlayer1.Open ;
if filelistbox1.ItemIndex=filelistbox1.Items.Count-1 then
MediaPlayer1.Notify :=false //当播放到最后一首时,停止响应ONNotify事件
else MediaPlayer1.Notify :=true;
MediaPlayer1.play;
end;
end;
lxpbuaa 2003-01-03
  • 打赏
  • 举报
回复
procedure TForm1.MediaPlayer1Notify(Sender: TObject);
begin
with Sender as TMediaPlayer do
begin
if Mode = mpStopped then
begin
//播放下一首歌
end;
Notify := True;
end;
end;

—————————————————————————————————
宠辱不惊,看庭前花开花落,去留无意;毁誉由人,望天上云卷云舒,聚散任风。
—————————————————————————————————

5,379

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧