出现"No MCI device open"问题,迷惑中(50分)

  • 主题发起人 主题发起人 watt
  • 开始时间 开始时间
W

watt

Unregistered / Unconfirmed
GUEST, unregistred user!
为什么在做播放器的时候会出现"No MCI device open"这样的问题,无奈中,迷惑中,高手指点迷津,如何解决?
 
帖出你的代码,可能是你代码问题
MediaPlayer1的autoopen设为True,然后设计时预先指定一个可播放的文件.

一般先Close一下,然后再Open
 
MediaPlayer1是不是不可以播放.rmvb格式的文件,我的代码如下,现在的问题是不能播放视频文件了,郁闷中呀
unit UPlayer;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, MPlayer, Buttons, OleCtrls, RealAudioObjects_TLB,
ComCtrls;

type
TForm1 = class(TForm)
Panel1: TPanel;
MediaPlayer1: TMediaPlayer;
SpeedButton1: TSpeedButton;
RealAudio1: TRealAudio;
Panel2: TPanel;
SpeedButton2: TSpeedButton;
SpeedButton3: TSpeedButton;
OpenDialog1: TOpenDialog;
TrackBar2: TTrackBar;
TrackBar1: TTrackBar;
procedure MediaPlayer1Click(Sender: TObject;
Button: TMPBtnType;
vardo
Default: Boolean);
procedure TrackBar1Change(Sender: TObject);
procedure TrackBar2Change(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
procedure SpeedButton3Click(Sender: TObject);
procedure MediaPlayer1Notify(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;


var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.MediaPlayer1Click(Sender: TObject;
Button: TMPBtnType;
vardo
Default: Boolean);
begin

mediaplayer1.Notify:=true;
//触发onnotify事件
mediaplayer1.DisplayRect:=panel1.ClientRect;
//将媒体在display对象的全屏播放
end;


procedure TForm1.TrackBar1Change(Sender: TObject);
begin

mediaplayer1.Stop;
//停止播放
mediaplayer1.Position:=trackbar1.Position;//将媒体位置设置为拖动的位置
mediaplayer1.Play;
//继续从当前位置播放
end;


procedure TForm1.TrackBar2Change(Sender: TObject);
begin

//如果speedbutton1按下,表示已经设置为静音
if not self.SpeedButton1.Down then

//将系统音量设置为trackbar拖动的位置大小
realaudio1.SetVolume(trackbar2.Position);

end;


procedure TForm1.SpeedButton2Click(Sender: TObject);
begin

self.SpeedButton1.Down:=true;
//按钮设置为按下状态
//realaudio1.SetVolume(0);
//静音,0代表静音
end;


procedure TForm1.SpeedButton3Click(Sender: TObject);
begin

if opendialog1.Execute then

begin

//将打开的媒体文件加载到媒体播放组件
mediaplayer1.FileName:=opendialog1.FileName;
end;


end;


procedure TForm1.MediaPlayer1Notify(Sender: TObject);
begin

if mediaplayer1.Notify and (mediaplayer1.Mode=mpstopped) then

begin

mediaplayer1.Stop;
mediaplayer1.Rewind;//将媒体回执到开始位置
mediaplayer1.Play;
//继续播放
end;

end;


procedure TForm1.SpeedButton1Click(Sender: TObject);
begin

begin

if mediaplayer1.Mode<>mpstopped then

mediaplayer1.Stop;//停止播放
form1.Close;
// 关闭窗体
end;

end;


end.
 
各位高手帮忙看看吧,不知道是怎么一回事,郁闷中哪
 
记得两年前我入门时写过一个垃圾播放器程序,我晚上回家再看看
 
在mediaplayer1.play之前要加上mediaplayer1.open吧
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
后退
顶部