Sets a preferred media source handler's GUID.
public virtual void SetPreferredMediaSourceHandler(
PreferredMediaSourceHandler MediaSourceHandlerType,
string val
)
Public Overridable Sub SetPreferredMediaSourceHandler( _
ByVal MediaSourceHandlerType As Leadtools.Mediafoundation.PreferredMediaSourceHandler, _
ByVal val As String _
)
public:
virtual void SetPreferredMediaSourceHandler(
Leadtools.Mediafoundation.PreferredMediaSourceHandler MediaSourceHandlerType,
String^ val
)
MediaSourceHandlerType
A PreferredMediaSourceHandler enumeration value specifying the desired media source handler type
val
String with the following possible values:
By default, the toolkit creates media sources according to the default Media Foundation mechanism, and that's by using a Source Resolver which is the standard way to create media sources. However, sometimes 3rd party media sources get installed on some computers and assigns their media source handler to a specific media type and are used instead of the media sources you shipped with your application. Unexpected problems can occur if these media sources are not working properly. The SetPreferredMediaSourceHandler method allows you to control which media sources are used in your application. You can decide to use a certain media source handler or you can choose to use only the LEAD ones. val is a string for the GUID of the media source handler.
This GUID uniquely identifies the media source handler. Every media format has one or more registered media source handlers that are responsible of creating a media source for this media type.
For example, the GUID for the LEAD MPEG2 Transport Media Source Handler is: EFE626C3-0A2C-49FA-8A01-3768B559B6DA
A list of display names for common media source handlers can be found in Constants.PreferredMediaSourceHandlers.
If the MediaSourceHandlerType parameter is equal to PreferredMediaSourceHandler.Generic, then the val parameter's possible values are PreferredMediaSourceHandlers.LEADDefault or PreferredMediaSourceHandlers.DontCare. If PreferredMediaSourceHandlers.LEADDefault is specified, then the default media source handlers will be set for all values listed in PreferredMediaSourceHandler. If PreferredMediaSourceHandlers.DontCare is specified, then the internal list of the preferred media source handler will be cleared and the media source will be created using the Media Foundation's default mechanism (Source Resolver).
It is recommended to use the constants from Constants.PreferredMediaSourceHandlers whenever possible.
using Leadtools;
using Leadtools.MediaFoundation;
using LeadtoolsMediaFoundationExamples.Fixtures;
public bool _result = false;
public PlayCtrlForm _form = new PlayCtrlForm();
public void PlayerPreferredMediaSourceHandlersExample()
{
PlayCtrl playctrl = _form.PlayCtrl;
try
{
// set the preferred ISO(MP4) media source handler to the LEAD default (which is the LEAD ISO Media Source handler)
playctrl.SetPreferredMediaSourceHandler(PreferredMediaSourceHandler.ISO, Constants.PreferredMediaSourceHandlers.LEADDefault);
// the default ISO(MP4) media source handler should be the LEAD ISO(MP4) media source handler now
_result = (string.Compare(playctrl.GetPreferredMediaSourceHandler(PreferredMediaSourceHandler.ISO),
Constants.PreferredMediaSourceHandlers.ISO, true) == 0);
}
catch (Exception)
{
_result = false;
}
}
Imports Leadtools
Imports Leadtools.MediaFoundation
Imports LeadtoolsMediaFoundationExamples.Fixtures
Public _result As Boolean = False
Public _form As PlayCtrlForm = New PlayCtrlForm()
Public Sub PlayerPreferredMediaSourceHandlersExample()
Try
' reference the forms play control
Dim playctrl As PlayCtrl = _form.PlayCtrl
' set the preferred ISO(MP4) media source handler to the LEAD default (which is the LEAD ISO Media Source handler)
playctrl.SetPreferredMediaSourceHandler(PreferredMediaSourceHandler.ISO,
Leadtools.MediaFoundation.Constants.PreferredMediaSourceHandlers.LEADDefault)
' the default ISO(MP4) media source handler should be the LEAD ISO(MP4) media source handler now
_result = (String.Compare(playctrl.GetPreferredMediaSourceHandler(PreferredMediaSourceHandler.ISO),
Leadtools.MediaFoundation.Constants.PreferredMediaSourceHandlers.ISO, True) = 0)
Catch e1 As Exception
_result = False
End Try
End Sub
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET