DSpack 从指定时刻开始播放的问题 如何使用DSpack在打开一个Avi文件的时候, 控制开始播放的时刻, 我按照很多方法试过, 无论怎样指定CurrPos, 开始播放的时候都是跳到开始位置才播放! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 高手帮忙:http://topic.csdn.net/u/20100510/09/50a51ee4-acd1-4254-88c3-c8c0b390f42f.html 我试过了,IMediaSeeking.setPosition 只能在文件已经打开后操作才可以!!论坛上的帖子已经有过类似的解决方法,而且有效的,但是,我想要的效果是打开文件的同时跳到指定的时间!!无论怎么操作都要跳到起始位置!! 可能楼主要的效果比较完美?先打开再定位,可能第一个画面会停留一下再跳到指定的位置是吧?如果不行那两个视频同时播放,只是切换videoWindow的前后位置呢? //==============================================================================// 改变当前播放的视频, aCurrPos,aStopPos本别代表重新载入的视频的起始播放位置// 为 0 时代表从当前播放的视频的当前位置开始播放新的视频//==============================================================================procedure TfrmVideo.ChangeCurrVideo(aVideoName: string = ''; aCurrPos: Int64 = 0; aStopPos: Int64 = 0; aVideoIndex: Integer = -1);var CurrPos, StopPos: Int64; MediaSeeking: IMediaSeeking;begin Timer.OnTimer:= nil; Timer.Enabled:= False; if not FilterGraph.Active then FilterGraph.Active:= True; if (aCurrPos = 0) and (aStopPos = 0) then begin FilterGraph.QueryInterface(IID_IMediaSeeking, MediaSeeking); MediaSeeking.GetPositions(CurrPos, StopPos); aCurrPos:= CurrPos; aStopPos:= StopPos; end; if ((aVideoName <> '') or (aVideoIndex > 0)) and ((aVideoName <> CurrVideo) and (aVideoIndex <> CurrIndex)) then begin if aVideoName = '' then aVideoName:= CurrVideo; if aVideoIndex < 0 then aVideoIndex:= CurrIndex; FilterGraph.ClearGraph; FilterGraph.RenderFile(VideoInfo.TimePath[aVideoIndex].Path + aVideoName + '.avi'); FilterGraph.Play; CurrVideo:= aVideoName; CurrIndex:= aVideoIndex; end; FCurrPos:= aCurrPos; FStopPos:= aStopPos; Self.Caption:= FCapion + FormatDateTime('hh:mm:ss', VideoInfo.TimePath[CurrIndex].Time); // 这种方式真变态? SetPositions 必须用事件激活? 为什么呢? // 想办法改变这种方式 Timer.Enabled:= True; Timer.OnTimer:= TimerTimer;end;timer的OnTimer中位IMediaSeeking.setPosition 本来在一个窗体中师可以的,把改变视频位置的代码放在其他时间中“触发”还勉强可以工作,可在MDI方式下就不行了 大体看明白了,试试在你的FilterGraph的OnDSEvent事件里当是EC_CLOCK_CHANGED事件时执行你的setposition procedure TFormPlayWin.FilterGraphDSEvent(sender: TComponent; Event, Param1, Param2: Integer);begin //log.Lines.Add(GetEventCodeDef(event)); if event = EC_CLOCK_CHANGED then MediaSeeking.SetPositionend; 试过了,还是不行阿!!是不是DSpack的固有问题呀,上面的代码你试过工作怎么样的效果阿? 我试过了没有问题你把你怎么做的发上来看看setposition部分 找人帮我美化完善一下程序 VC动态库DLL在DELPHI下调用 濡備綍鑾峰緱鎺т欢鏁扮粍鐨勫璞″悕 郁闷...散分! 高分求解两个简单的问题 代码如何简写? 怎样设置双面打印? TQuery OPEN执行后,返回了一些数据,但RECNO始终是-1?后台数据库是IBM DB2/400。(无内容) 使用spcomm控件读写串口,怎么判断串口是否已经打开? dbgrideh数据导出的问题 Delphi调用VB写的COM组件时参数传递问题,谢谢 dll注入,处理多线程
论坛上的帖子已经有过类似的解决方法,而且有效的,
但是,我想要的效果是打开文件的同时跳到指定的时间!!
无论怎么操作都要跳到起始位置!!
如果不行那两个视频同时播放,只是切换videoWindow的前后位置呢?
// 改变当前播放的视频, aCurrPos,aStopPos本别代表重新载入的视频的起始播放位置
// 为 0 时代表从当前播放的视频的当前位置开始播放新的视频
//==============================================================================
procedure TfrmVideo.ChangeCurrVideo(aVideoName: string = ''; aCurrPos: Int64 = 0; aStopPos: Int64 = 0; aVideoIndex: Integer = -1);
var
CurrPos, StopPos: Int64;
MediaSeeking: IMediaSeeking;
begin
Timer.OnTimer:= nil;
Timer.Enabled:= False;
if not FilterGraph.Active then
FilterGraph.Active:= True;
if (aCurrPos = 0) and (aStopPos = 0) then
begin
FilterGraph.QueryInterface(IID_IMediaSeeking, MediaSeeking);
MediaSeeking.GetPositions(CurrPos, StopPos);
aCurrPos:= CurrPos;
aStopPos:= StopPos;
end; if ((aVideoName <> '') or (aVideoIndex > 0)) and ((aVideoName <> CurrVideo) and (aVideoIndex <> CurrIndex)) then
begin
if aVideoName = '' then
aVideoName:= CurrVideo;
if aVideoIndex < 0 then
aVideoIndex:= CurrIndex; FilterGraph.ClearGraph;
FilterGraph.RenderFile(VideoInfo.TimePath[aVideoIndex].Path + aVideoName + '.avi');
FilterGraph.Play;
CurrVideo:= aVideoName;
CurrIndex:= aVideoIndex;
end; FCurrPos:= aCurrPos;
FStopPos:= aStopPos;
Self.Caption:= FCapion + FormatDateTime('hh:mm:ss', VideoInfo.TimePath[CurrIndex].Time); // 这种方式真变态? SetPositions 必须用事件激活? 为什么呢?
// 想办法改变这种方式
Timer.Enabled:= True;
Timer.OnTimer:= TimerTimer;
end;timer的OnTimer中位IMediaSeeking.setPosition
本来在一个窗体中师可以的,把改变视频位置的代码放在其他时间中“触发”还勉强可以工作,
可在MDI方式下就不行了
Param1, Param2: Integer);
begin
//log.Lines.Add(GetEventCodeDef(event));
if event = EC_CLOCK_CHANGED then
MediaSeeking.SetPosition
end;
你把你怎么做的发上来看看setposition部分