小记一下DirectX里的Video和Audio

原本是DX里的一个例子,我觉得还可以,就COPY出来,想改改看。结果让我大失所望。
最简单要求,就是对音频文件和视频文件可以定位查找,本来它的Video和Audio类都提供了Seek方法,但它们根本不能工作,每次Seek后,都回到0的位置上。后来用Reflector来看它的源代码,结果也是不尽人意,很多底层的代码没有办法反射出来。特别是DX里的一些接口,根本无法查看。最后也只好先暂停了。
本来还想着,要是DX在.Net下封装的比较好的话,我就可以少用C++的COM组件了,直接用C#来写组件也方便多了。没想到MS的托管DX确实还不够完善,我看可能要等以后的版本了。不过它的MediaPlay的SDK还是不错的,有机会也看看。

None.gif using  System;
None.gif
using  System.Drawing;
None.gif
using  System.Collections;
None.gif
using  System.ComponentModel;
None.gif
using  System.Windows.Forms;
None.gif
using  Microsoft.DirectX;
None.gif
using  Microsoft.DirectX.AudioVideoPlayback;
None.gif
None.gif
namespace  Webb.DirectX.Debug2
ExpandedBlockStart.gifContractedBlock.gif
dot.gif {
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//// <summary>
InBlock.gif    
/// Summary description for Form1.
ExpandedSubBlockEnd.gif    
/// </summary>

InBlock.gif    public class AVPlayer : System.Windows.Forms.Form
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif
InBlock.gif        
private string filterText = "Video Files (*.avi; *.qt; *.mov; *.mpg; *.mpeg; *.m1v; *.wmv)|*.avi; *.qt; *.mov; *.mpg; *.mpeg; *.m1v; *.wmv|" +
InBlock.gif            
"Audio files (*.wav; *.mpa; *.mp2; *.mp3; *.au; *.aif; *.aiff; *.snd; *.wma)|*.wav; *.mpa; *.mp2; *.mp3; *.au; *.aif; *.aiff; *.snd; *.wma|" +
InBlock.gif            
"MIDI Files (*.mid, *.midi, *.rmi)|*.mid; *.midi; *.rmi|" +
InBlock.gif            
"Image Files (*.jpg, *.bmp, *.gif, *.tga)|*.jpg; *.bmp; *.gif; *.tga|" +
InBlock.gif            
"All Files (*.*)|*.*";
InBlock.gif
InBlock.gif        
private Video ourVideo = null;
InBlock.gif        
private Audio ourAudio = null;
InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        
Winforms variables#region Winforms variables
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// Required designer variable.
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        private System.ComponentModel.Container components = null;
InBlock.gif        
private System.Windows.Forms.MainMenu mnuMain;
InBlock.gif        
private System.Windows.Forms.OpenFileDialog ofdOpen;
InBlock.gif        
private System.Windows.Forms.MenuItem menuItem3;
InBlock.gif        
private System.Windows.Forms.MenuItem mnuFile;
InBlock.gif        
private System.Windows.Forms.MenuItem mnuOpen;
InBlock.gif        
private System.Windows.Forms.MenuItem menuItem1;
InBlock.gif        
private System.Windows.Forms.MenuItem mnuPlay;
InBlock.gif        
private System.Windows.Forms.MenuItem mnuStop;
InBlock.gif        
private System.Windows.Forms.MenuItem mnuPause;
InBlock.gif        
private System.Windows.Forms.MenuItem menuItem2;
InBlock.gif        
private System.Windows.Forms.MenuItem mnuFull;
InBlock.gif        
private System.Windows.Forms.ToolBar toolBar1;
InBlock.gif        
private System.Windows.Forms.ToolBarButton toolBarButton1;
InBlock.gif        
private System.Windows.Forms.ToolBarButton toolBarButton2;
InBlock.gif        
private System.Windows.Forms.ToolBarButton toolBarButton3;
InBlock.gif        
private System.Windows.Forms.ToolBarButton toolBarButton4;
InBlock.gif        
private System.Windows.Forms.ToolBarButton toolBarButton5;
InBlock.gif        
private System.Windows.Forms.MenuItem mnuExit;
ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
InBlock.gif        
public AVPlayer()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
//
InBlock.gif            
// Required for Windows Form Designer support
InBlock.gif            
//
InBlock.gif
            InitializeComponent();
InBlock.gif
InBlock.gif            OpenFile();
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
private bool _IsVideo = false;
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// Clean up any resources being used.
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        protected override void Dispose( bool disposing )
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            CleanupObjects();
InBlock.gif            
if( disposing )
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
if (components != null
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    components.Dispose();
ExpandedSubBlockEnd.gif                }

ExpandedSubBlockEnd.gif            }

InBlock.gif            
base.Dispose( disposing );
ExpandedSubBlockEnd.gif        }

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        
Windows Form Designer generated code#region Windows Form Designer generated code
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// Required method for Designer support - do not modify
InBlock.gif        
/// the contents of this method with the code editor.
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        private void InitializeComponent()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
this.mnuMain = new System.Windows.Forms.MainMenu();
InBlock.gif            
this.mnuFile = new System.Windows.Forms.MenuItem();
InBlock.gif            
this.mnuOpen = new System.Windows.Forms.MenuItem();
InBlock.gif            
this.menuItem3 = new System.Windows.Forms.MenuItem();
InBlock.gif            
this.mnuExit = new System.Windows.Forms.MenuItem();
InBlock.gif            
this.menuItem1 = new System.Windows.Forms.MenuItem();
InBlock.gif            
this.mnuPlay = new System.Windows.Forms.MenuItem();
InBlock.gif            
this.mnuStop = new System.Windows.Forms.MenuItem();
InBlock.gif            
this.mnuPause = new System.Windows.Forms.MenuItem();
InBlock.gif            
this.menuItem2 = new System.Windows.Forms.MenuItem();
InBlock.gif            
this.mnuFull = new System.Windows.Forms.MenuItem();
InBlock.gif            
this.ofdOpen = new System.Windows.Forms.OpenFileDialog();
InBlock.gif            
this.toolBar1 = new System.Windows.Forms.ToolBar();
InBlock.gif            
this.toolBarButton1 = new System.Windows.Forms.ToolBarButton();
InBlock.gif            
this.toolBarButton2 = new System.Windows.Forms.ToolBarButton();
InBlock.gif            
this.toolBarButton3 = new System.Windows.Forms.ToolBarButton();
InBlock.gif            
this.toolBarButton4 = new System.Windows.Forms.ToolBarButton();
InBlock.gif            
this.toolBarButton5 = new System.Windows.Forms.ToolBarButton();
InBlock.gif            
this.SuspendLayout();
InBlock.gif            
// 
InBlock.gif            
// mnuMain
InBlock.gif            
// 
ExpandedSubBlockStart.gifContractedSubBlock.gif
            this.mnuMain.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] dot.gif{
InBlock.gif                                                                                    
this.mnuFile,
ExpandedSubBlockEnd.gif                                                                                    
this.menuItem1}
);
InBlock.gif            
// 
InBlock.gif            
// mnuFile
InBlock.gif            
// 
InBlock.gif
            this.mnuFile.Index = 0;
ExpandedSubBlockStart.gifContractedSubBlock.gif            
this.mnuFile.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] dot.gif{
InBlock.gif                                                                                    
this.mnuOpen,
InBlock.gif                                                                                    
this.menuItem3,
ExpandedSubBlockEnd.gif                                                                                    
this.mnuExit}
);
InBlock.gif            
this.mnuFile.Text = "&File";
InBlock.gif            
// 
InBlock.gif            
// mnuOpen
InBlock.gif            
// 
InBlock.gif
            this.mnuOpen.Index = 0;
InBlock.gif            
this.mnuOpen.Shortcut = System.Windows.Forms.Shortcut.CtrlO;
InBlock.gif            
this.mnuOpen.Text = "&Open Clip";
InBlock.gif            
this.mnuOpen.Click += new System.EventHandler(this.mnuOpen_Click);
InBlock.gif            
// 
InBlock.gif            
// menuItem3
InBlock.gif            
// 
InBlock.gif
            this.menuItem3.Index = 1;
InBlock.gif            
this.menuItem3.Text = "-";
InBlock.gif            
// 
InBlock.gif            
// mnuExit
InBlock.gif            
// 
InBlock.gif
            this.mnuExit.Index = 2;
InBlock.gif            
this.mnuExit.Text = "E&xit";
InBlock.gif            
this.mnuExit.Click += new System.EventHandler(this.mnuExit_Click);
InBlock.gif            
// 
InBlock.gif            
// menuItem1
InBlock.gif            
// 
InBlock.gif
            this.menuItem1.Index = 1;
ExpandedSubBlockStart.gifContractedSubBlock.gif            
this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] dot.gif{
InBlock.gif                                                                                      
this.mnuPlay,
InBlock.gif                                                                                      
this.mnuStop,
InBlock.gif                                                                                      
this.mnuPause,
InBlock.gif                                                                                      
this.menuItem2,
ExpandedSubBlockEnd.gif                                                                                      
this.mnuFull}
);
InBlock.gif            
this.menuItem1.Text = "&Control";
InBlock.gif            
// 
InBlock.gif            
// mnuPlay
InBlock.gif            
// 
InBlock.gif
            this.mnuPlay.Index = 0;
InBlock.gif            
this.mnuPlay.Shortcut = System.Windows.Forms.Shortcut.CtrlP;
InBlock.gif            
this.mnuPlay.Text = "&Play";
InBlock.gif            
this.mnuPlay.Click += new System.EventHandler(this.mnuPlay_Click);
InBlock.gif            
// 
InBlock.gif            
// mnuStop
InBlock.gif            
// 
InBlock.gif
            this.mnuStop.Index = 1;
InBlock.gif            
this.mnuStop.Shortcut = System.Windows.Forms.Shortcut.CtrlS;
InBlock.gif            
this.mnuStop.Text = "&Stop";
InBlock.gif            
this.mnuStop.Click += new System.EventHandler(this.mnuStop_Click);
InBlock.gif            
// 
InBlock.gif            
// mnuPause
InBlock.gif            
// 
InBlock.gif
            this.mnuPause.Index = 2;
InBlock.gif            
this.mnuPause.Shortcut = System.Windows.Forms.Shortcut.CtrlA;
InBlock.gif            
this.mnuPause.Text = "P&ause";
InBlock.gif            
this.mnuPause.Click += new System.EventHandler(this.mnuPause_Click);
InBlock.gif            
// 
InBlock.gif            
// menuItem2
InBlock.gif            
// 
InBlock.gif
            this.menuItem2.Index = 3;
InBlock.gif            
this.menuItem2.Text = "-";
InBlock.gif            
// 
InBlock.gif            
// mnuFull
InBlock.gif            
// 
InBlock.gif
            this.mnuFull.Index = 4;
InBlock.gif            
this.mnuFull.Text = "Toggle Fu&llscreen\t<Alt-Enter>";
InBlock.gif            
this.mnuFull.Click += new System.EventHandler(this.mnuFull_Click);
InBlock.gif            
// 
InBlock.gif            
// toolBar1
InBlock.gif            
// 
ExpandedSubBlockStart.gifContractedSubBlock.gif
            this.toolBar1.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] dot.gif{
InBlock.gif                                                                                        
this.toolBarButton1,
InBlock.gif                                                                                        
this.toolBarButton2,
InBlock.gif                                                                                        
this.toolBarButton3,
InBlock.gif                                                                                        
this.toolBarButton4,
ExpandedSubBlockEnd.gif                                                                                        
this.toolBarButton5}
);
InBlock.gif            
this.toolBar1.DropDownArrows = true;
InBlock.gif            
this.toolBar1.Location = new System.Drawing.Point(00);
InBlock.gif            
this.toolBar1.Name = "toolBar1";
InBlock.gif            
this.toolBar1.ShowToolTips = true;
InBlock.gif            
this.toolBar1.Size = new System.Drawing.Size(53642);
InBlock.gif            
this.toolBar1.TabIndex = 0;
InBlock.gif            
this.toolBar1.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar1_ButtonClick);
InBlock.gif            
// 
InBlock.gif            
// toolBarButton1
InBlock.gif            
// 
InBlock.gif
            this.toolBarButton1.Text = "Play";
InBlock.gif            
// 
InBlock.gif            
// toolBarButton2
InBlock.gif            
// 
InBlock.gif
            this.toolBarButton2.Text = "Stop";
InBlock.gif            
// 
InBlock.gif            
// toolBarButton3
InBlock.gif            
// 
InBlock.gif
            this.toolBarButton3.Text = "End";
InBlock.gif            
// 
InBlock.gif            
// toolBarButton4
InBlock.gif            
// 
InBlock.gif
            this.toolBarButton4.Text = "Begin";
InBlock.gif            
// 
InBlock.gif            
// toolBarButton5
InBlock.gif            
// 
InBlock.gif
            this.toolBarButton5.Text = "Next";
InBlock.gif            
// 
InBlock.gif            
// AVPlayer
InBlock.gif            
// 
InBlock.gif
            this.AutoScaleBaseSize = new System.Drawing.Size(513);
InBlock.gif            
this.ClientSize = new System.Drawing.Size(536305);
InBlock.gif            
this.Controls.Add(this.toolBar1);
InBlock.gif            
this.Menu = this.mnuMain;
InBlock.gif            
this.Name = "AVPlayer";
InBlock.gif            
this.Text = "Audio Video Player";
InBlock.gif            
this.ResumeLayout(false);
InBlock.gif
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
InBlock.gif        
private void CleanupObjects()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
if (ourVideo != null)
InBlock.gif                ourVideo.Dispose();
InBlock.gif            
if (ourAudio != null)
InBlock.gif                ourAudio.Dispose();
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
private void OpenFile()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif
//            if ((ofdOpen.InitialDirectory == null) || (ofdOpen.InitialDirectory == string.Empty))
InBlock.gif
//                ofdOpen.InitialDirectory = DXUtil.SdkMediaPath;
InBlock.gif

InBlock.gif            ofdOpen.Filter 
= filterText;
InBlock.gif            ofdOpen.Title 
= "Open media file";
InBlock.gif            ofdOpen.ShowDialog(
this);
InBlock.gif
InBlock.gif            
// Now let's try to open this file
InBlock.gif
            if ((ofdOpen.FileName != null&& (ofdOpen.FileName != string.Empty))
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
try
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    
if (ourVideo == null)
ExpandedSubBlockStart.gifContractedSubBlock.gif                    
dot.gif{
InBlock.gif                        
// First try to open this as a video file
InBlock.gif
                        ourVideo = new Video(ofdOpen.FileName);
InBlock.gif                        ourVideo.Ending 
+= new System.EventHandler(this.ClipEnded);
InBlock.gif                        ourVideo.Owner 
= this;
InBlock.gif                        
// Start playing now
InBlock.gif
                        ourVideo.Play();
InBlock.gif                        
this._IsVideo = true;
ExpandedSubBlockEnd.gif                    }

InBlock.gif                    
else
ExpandedSubBlockStart.gifContractedSubBlock.gif                    
dot.gif{
InBlock.gif                        ourVideo.Open(ofdOpen.FileName, 
true);
ExpandedSubBlockEnd.gif                    }

ExpandedSubBlockEnd.gif                }

InBlock.gif                
catch
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    
try
ExpandedSubBlockStart.gifContractedSubBlock.gif                    
dot.gif{
InBlock.gif                        
// opening this as a video file failed.. Maybe it's audio only?
InBlock.gif
                        ourAudio = new Audio(ofdOpen.FileName);
InBlock.gif                        ourAudio.Ending 
+= new System.EventHandler(this.ClipEnded);
InBlock.gif                        
// Start playing now
InBlock.gif
                        ourAudio.Play();
InBlock.gif                        
this._IsVideo = false;
ExpandedSubBlockEnd.gif                    }

InBlock.gif                    
catch
ExpandedSubBlockStart.gifContractedSubBlock.gif                    
dot.gif{
InBlock.gif                        MessageBox.Show(
"This file could not be opened.""Invalid file.", MessageBoxButtons.OK, MessageBoxIcon.Information);
ExpandedSubBlockEnd.gif                    }

ExpandedSubBlockEnd.gif                }

ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
private void ClipEnded(object sender, System.EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
// The clip has ended, stop and restart it
InBlock.gif
//            if (ourVideo != null)
InBlock.gif
//            {
InBlock.gif
//                ourVideo.Stop();
InBlock.gif
//                ourVideo.Play();
InBlock.gif
//            }
InBlock.gif
//            else
InBlock.gif
//            {
InBlock.gif
//                if (ourAudio != null)
InBlock.gif
//                {
InBlock.gif
//                    ourAudio.Stop();
InBlock.gif
//                    ourAudio.Play();
InBlock.gif
//                }
InBlock.gif
//            }
ExpandedSubBlockEnd.gif
        }

InBlock.gif
InBlock.gif        
private void mnuOpen_Click(object sender, System.EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
this.OpenFile();
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
private void mnuPlay_Click(object sender, System.EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
if (ourVideo != null)
InBlock.gif                ourVideo.Play();
InBlock.gif            
else
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
if (ourAudio != null)
InBlock.gif                    ourAudio.Play();
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
private void mnuStop_Click(object sender, System.EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
if (ourVideo != null)
InBlock.gif                ourVideo.Stop();
InBlock.gif            
else
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
if (ourAudio != null)
InBlock.gif                    ourAudio.Stop();
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
private void mnuPause_Click(object sender, System.EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
if (ourVideo != null)
InBlock.gif                ourVideo.Pause();
InBlock.gif            
else
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
if (ourAudio != null)
InBlock.gif                    ourAudio.Pause();
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
private void mnuExit_Click(object sender, System.EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
this.Dispose();
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
private void mnuFull_Click(object sender, System.EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
if (ourVideo != null)
InBlock.gif                ourVideo.Fullscreen 
= !ourVideo.Fullscreen;
ExpandedSubBlockEnd.gif        }

InBlock.gif        
protected override void OnKeyDown(System.Windows.Forms.KeyEventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
if ( (e.Alt) && (e.KeyCode == System.Windows.Forms.Keys.Return))
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                mnuFull_Click(mnuFull, 
null);
ExpandedSubBlockEnd.gif            }

InBlock.gif
InBlock.gif            
// Allow the control to handle the keystroke now
InBlock.gif
            base.OnKeyDown(e);
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
private void toolBar1_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
InBlock.gif            
switch(e.Button.Text)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
case "Play":
InBlock.gif                    
if(this._IsVideo)
ExpandedSubBlockStart.gifContractedSubBlock.gif                    
dot.gif{
InBlock.gif                        
this.ourVideo.Play();
ExpandedSubBlockEnd.gif                    }

InBlock.gif                    
else
ExpandedSubBlockStart.gifContractedSubBlock.gif                    
dot.gif{
InBlock.gif                        
this.ourAudio.Play();
ExpandedSubBlockEnd.gif                    }

InBlock.gif                    
break;
InBlock.gif                
case "End":
InBlock.gif                    
if(_IsVideo)
ExpandedSubBlockStart.gifContractedSubBlock.gif                    
dot.gif{
InBlock.gif                        
double m_length = this.ourVideo.Duration;                    
InBlock.gif                        
try
ExpandedSubBlockStart.gifContractedSubBlock.gif                        
dot.gif{
InBlock.gif                            
if(this.ourVideo.SeekingCaps.CanSeekForwards)
ExpandedSubBlockStart.gifContractedSubBlock.gif                            
dot.gif{
InBlock.gif                                
double m_result = this.ourVideo.SeekCurrentPosition(5,SeekPositionFlags.AbsolutePositioning);
InBlock.gif                                MessageBox.Show(m_result.ToString());
ExpandedSubBlockEnd.gif                            }

ExpandedSubBlockEnd.gif                        }

InBlock.gif                        
catch(Exception ex)
ExpandedSubBlockStart.gifContractedSubBlock.gif                        
dot.gif{
InBlock.gif                            MessageBox.Show(ex.Message);
ExpandedSubBlockEnd.gif                        }

InBlock.gif                        
this.ourVideo.Pause();
ExpandedSubBlockEnd.gif                    }

InBlock.gif                    
else
ExpandedSubBlockStart.gifContractedSubBlock.gif                    
dot.gif{
InBlock.gif                        
double m_length = this.ourAudio.Duration;
InBlock.gif                        
double m_result = this.ourAudio.SeekCurrentPosition(5,SeekPositionFlags.AbsolutePositioning);
InBlock.gif                        
this.ourAudio.Pause();
ExpandedSubBlockEnd.gif                    }

InBlock.gif                    
break;
InBlock.gif                
case "Begin":
InBlock.gif                    
if(_IsVideo)
ExpandedSubBlockStart.gifContractedSubBlock.gif                    
dot.gif{
InBlock.gif                        
this.ourVideo.SeekCurrentPosition(0,SeekPositionFlags.AbsolutePositioning);
InBlock.gif                        
this.ourVideo.Pause();
ExpandedSubBlockEnd.gif                    }

InBlock.gif                    
else
ExpandedSubBlockStart.gifContractedSubBlock.gif                    
dot.gif{
InBlock.gif                        
this.ourAudio.SeekCurrentPosition(0,SeekPositionFlags.AbsolutePositioning);
InBlock.gif                        
this.ourAudio.Pause();
ExpandedSubBlockEnd.gif                    }

InBlock.gif                    
break;
InBlock.gif                
case "Stop":
InBlock.gif                    
if(_IsVideo)
ExpandedSubBlockStart.gifContractedSubBlock.gif                    
dot.gif{
InBlock.gif                        
this.ourVideo.Pause();
ExpandedSubBlockEnd.gif                    }

InBlock.gif                    
else
ExpandedSubBlockStart.gifContractedSubBlock.gif                    
dot.gif{
InBlock.gif                        
this.ourAudio.Pause();
ExpandedSubBlockEnd.gif                    }

InBlock.gif                    
break;
InBlock.gif                
case "Next":
InBlock.gif                    
if(_IsVideo)
ExpandedSubBlockStart.gifContractedSubBlock.gif                    
dot.gif{
InBlock.gif                        
this.ourVideo.SeekCurrentPosition(5,SeekPositionFlags.IncrementalPositioning);
InBlock.gif                        
//this.ourVideo.Pause();
ExpandedSubBlockEnd.gif
                    }

InBlock.gif                    
else
ExpandedSubBlockStart.gifContractedSubBlock.gif                    
dot.gif{
InBlock.gif                        
this.ourAudio.SeekCurrentPosition(5,SeekPositionFlags.IncrementalPositioning);
InBlock.gif                        
//this.ourAudio.Pause();
ExpandedSubBlockEnd.gif
                    }

InBlock.gif                    
break;
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif    }

ExpandedBlockEnd.gif}

None.gif


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值