本文整理汇总了C#中IMediaPosition.put_CurrentPosition方法的典型用法代码示例。如果您正苦于以下问题:C# IMediaPosition.put_CurrentPosition方法的具体用法?C# IMediaPosition.put_CurrentPosition怎么用?C# IMediaPosition.put_CurrentPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMediaPosition
的用法示例。
在下文中一共展示了IMediaPosition.put_CurrentPosition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PlayMovieInWindow
//.........这里部分代码省略.........
if (EVRControl == null)
{
//Ищем рендерер и ВКЛЮЧАЕМ соблюдение аспекта (рендерер сам подгонит картинку под размер окна, с учетом аспекта)
IsRendererARFixed = false;
IBaseFilter filter = null;
graphBuilder.FindFilterByName("Video Renderer", out filter);
if (filter != null)
{
IVMRAspectRatioControl vmr = filter as IVMRAspectRatioControl;
if (vmr != null)
{
DsError.ThrowExceptionForHR(vmr.SetAspectRatioMode(VMRAspectRatioMode.LetterBox));
IsRendererARFixed = true;
}
}
else
{
graphBuilder.FindFilterByName("Video Mixing Renderer 9", out filter);
if (filter != null)
{
IVMRAspectRatioControl9 vmr9 = filter as IVMRAspectRatioControl9;
if (vmr9 != null)
{
DsError.ThrowExceptionForHR(vmr9.SetAspectRatioMode(VMRAspectRatioMode.LetterBox));
IsRendererARFixed = true;
}
}
}
}
else
IsRendererARFixed = true;
this.mediaControl = (IMediaControl)this.graphBuilder;
this.mediaEventEx = (IMediaEventEx)this.graphBuilder;
this.mediaSeeking = (IMediaSeeking)this.graphBuilder;
this.mediaPosition = (IMediaPosition)this.graphBuilder;
this.videoWindow = (EVRControl == null) ? this.graphBuilder as IVideoWindow : null;
this.basicVideo = (EVRControl == null) ? this.graphBuilder as IBasicVideo : null;
this.basicAudio = this.graphBuilder as IBasicAudio;
this.basicAudio.put_Volume(VolumeSet);
this.CheckIsAudioOnly();
if (!this.isAudioOnly)
{
if (videoWindow != null)
{
hr = this.videoWindow.put_Owner(this.source.Handle);
DsError.ThrowExceptionForHR(hr);
hr = this.videoWindow.put_MessageDrain(this.source.Handle);
DsError.ThrowExceptionForHR(hr);
hr = this.videoWindow.put_WindowStyle(DirectShowLib.WindowStyle.Child | DirectShowLib.WindowStyle.ClipSiblings | DirectShowLib.WindowStyle.ClipChildren);
DsError.ThrowExceptionForHR(hr);
}
this.MoveVideoWindow();
}
else
{
if (VHost != null)
{
VHost.Dispose();
VHost = null;
VHandle = IntPtr.Zero;
VHostElement.Child = null;
VHostElement.Visibility = Visibility.Collapsed;
}
}
hr = this.mediaEventEx.SetNotifyWindow(this.source.Handle, WMGraphNotify, IntPtr.Zero);
DsError.ThrowExceptionForHR(hr);
//Восстанавливаем старую позицию
if (mediaload == MediaLoad.Update && oldpos != TimeSpan.Zero)
{
if (NaturalDuration >= oldpos)
{
hr = mediaPosition.put_CurrentPosition(oldpos.TotalSeconds);
DsError.ThrowExceptionForHR(hr);
}
}
//Восстанавливаем старый PlayState
if (mediaload == MediaLoad.Update && (oldplaystate == PlayState.Paused || oldplaystate == PlayState.Stopped))
{
hr = this.mediaControl.Pause();
DsError.ThrowExceptionForHR(hr);
this.currentState = PlayState.Paused;
this.SetPlayIcon();
}
else
{
hr = this.mediaControl.Run();
DsError.ThrowExceptionForHR(hr);
this.currentState = PlayState.Running;
this.SetPauseIcon();
}
AddFiltersToMenu();
}