LEADTOOLS Multimedia (Leadtools.MediaFoundation assembly)

ErrorAbort Event (PlayCtrl)

Show in webframe
Example 



Occurs when an error has caused an operation to abort.
Syntax
'Declaration
 
Public Event ErrorAbort As ErrorAbortEventHandler
'Usage
 
Dim instance As PlayCtrl
Dim handler As ErrorAbortEventHandler
 
AddHandler instance.ErrorAbort, handler
public event ErrorAbortEventHandler ErrorAbort
public:
event ErrorAbortEventHandler^ ErrorAbort
Remarks
The event handler is passed an ErrorAbortEventArgs object containing the related error code. For more information, refer to the Error Codes.
Example
Copy Code  
Imports Leadtools
Imports Leadtools.MediaFoundation
Imports LeadtoolsMediaFoundationExamples.Fixtures

Public _result As Boolean = False
Public _form As PlayCtrlForm = New PlayCtrlForm()
Public Sub ErrorAbortExample()
   ' reference the play control
   Dim playctrl As PlayCtrl = _form.PlayCtrl

   Dim inFile As String = Path.Combine(LEAD_VARS.MediaDir, "PlayCtrl_Source.avi")

   Try
      AddHandler playctrl.ErrorAbort, AddressOf ErrorAbort_Helper
      playctrl.SourceFile = inFile
      playctrl.Run()
   Catch cex As COMException
      If cex.ErrorCode = CInt(ErrorCode.VFW_S_VIDEO_NOT_RENDERED) Then
         _result = False
      End If
   Catch e1 As Exception
      _result = False
   End Try

   ' we'll loop on the state and pump messages for this example.
   ' but you should not need to if running from a Windows Forms application.
   Do While playctrl.State = PlayState.Running
      Application.DoEvents()
   Loop
End Sub

Public Sub ErrorAbort_Helper(ByVal sender As Object, ByVal e As ErrorAbortEventArgs)
   ' set result
   _result = True
End Sub

Public NotInheritable Class LEAD_VARS
Public Const MediaDir As String = "C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 18\Media"
End Class
using Leadtools;
using Leadtools.MediaFoundation;
using LeadtoolsMediaFoundationExamples.Fixtures;

public bool _result = false;
public PlayCtrlForm _form = new PlayCtrlForm();
public void ErrorAbortExample()
{
   // reference the play control
   PlayCtrl playctrl = _form.PlayCtrl;

   string inFile =Path.Combine(LEAD_VARS.MediaDir,"PlayCtrl_Source.avi");

   try
   {
      playctrl.ErrorAbort += new ErrorAbortEventHandler(ErrorAbort_Helper);
      playctrl.SourceFile = inFile;
      playctrl.Run();
   }
   catch (COMException cex)
   {
      if (cex.ErrorCode == (int)ErrorCode.VFW_S_VIDEO_NOT_RENDERED)
         _result = false;
   }
   catch (Exception)
   {
      _result = false;
   }

   // we'll loop on the state and pump messages for this example.
   // but you should not need to if running from a Windows Forms application.
   while (playctrl.State == PlayState.Running)
      Application.DoEvents();
}

public void ErrorAbort_Helper(object sender, ErrorAbortEventArgs e)
{
   // set result
   _result = true;
}

static class LEAD_VARS
{
public const string MediaDir = @"C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 18\Media";
}
Requirements

Target Platforms

See Also

Reference

PlayCtrl Class
PlayCtrl Members

 

 


Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.

Leadtools.MediaFoundation requires a Multimedia or Multimedia Suite license and unlock key. For more information, refer to: LEADTOOLS Toolkit Features