procedure TForm1.openbtnClick(Sender: TObject);
begin
if not FilterGraph1.Active then
FilterGraph1.Active := true;//初始化各Filter,并建立FilterGraph
filterGraph1.ClearGraph ; //清除原有影像
opendialog1.Execute ;
if opendialog1.FileName='' then exit;
FilterGraph1.RenderFile(opendialog1.FileName ); //呈交檔案
SoundLevelbar.Position :=8000;
end;
procedure TForm1.playbtnClick(Sender: TObject);
begin
filterGraph1.Play ;
end;
procedure TForm1.pausebtnClick(Sender: TObject);
begin
filterGraph1.Pause ;
end;
procedure TForm1.stopbtnClick(Sender: TObject);
begin
filterGraph1.Stop ; //點擊該按鈕停止播放后再點play按鈕時又從原來停止的位置往下播放了。這就等同于暫停功能了。
end;
正常的功能應該是無論在檔案的哪個位置停止都會重新從頭播放的。我試了2.34版本中的幾個demo例程,居然也都存在這個問題。請高手給解決一下,謝啦。
uj5u.com熱心網友回復:
有沒有熟悉directxShow開發的大神們?我們面對存在的問題不能回避對不對?您們能不能至少提供一下這方面的資料、思路?uj5u.com熱心網友回復:
停止: FilterGraph1.Stop;暫停: FilterGraph1.Pause;
uj5u.com熱心網友回復:
大神:操作程序中FilterGraph1.Stop;
的實際效果與FilterGraph1.Pause;
一樣啊。也就是說它等同于暫停按鈕的效果。怎樣才能在視頻檔案的任意處stop而后再播放時都是從頭開始的?這方面的資料少啊。要不您空閑之余試一下?我參考的是http://www.cnblogs.com/doit8791/archive/2012/07/09/2583875.html
uj5u.com熱心網友回復:
是的效果是一樣。如果要重頭播放,可以使用以下代碼(這是我的程式中的),俟代參考:
RepeatPlay:=False;;
PlayListItem := pPlayListitem(Listbox1.Items.Objects[ListBox1.Itemindex]);
Filename := PlayListItem^.Path;
If Filename[Length(Filename)] <> '\' then
Filename := Filename + '\';
Filename := Filename + PlayListItem^.Filename;
PlayFile(Filename);
FilterGraph1.QueryInterface(IMediaSeeking, MediaSeeking);
with MediaSeeking do
Begin
GetCurrentPosition(CurrPos); // Play當前秒 0秒起步
GetStopPosition(EndPos); // 播放長度
end;
AllPos:=EndPos;
PlayingIndex := Listbox1.Itemindex;
If PlayingIndex > 0 then
SpeedButton6.Enabled := True
else
SpeedButton6.Enabled := False;
if PlayingIndex < Listbox1.Items.Count -1 then
SpeedButton7.Enabled := True
else
SpeedButton7.Enabled := False;
uj5u.com熱心網友回復:
大神:操作程序中FilterGraph1.Stop;的實際效果與FilterGraph1.Pause;
一樣啊。也就是說它等同于暫停按鈕的效果。怎樣才能在視頻檔案的任意處stop而后再播放時都是從頭開始的
這個只要stop 后,復位即可啊。或者做個標記,重新播放時候強制從頭開始。
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/97407.html
上一篇:QLabel圖片自適應
