How can I set custom preview for input stream?

From AVObjects Knowledge Base
Jump to: navigation, search

You can do this using the MGPreview object of MGCORElib:

C# sample code:

//Get the input stream
string vidName;
string audName;
object mgObject;
m_objVideoMixer.GetInputDevice(0, out vidName, out audName, out mgObject);
MGVIDEOMIXERLib.IMGObject mgObj = (MGVIDEOMIXERLib.IMGObject)mgObject;
 
//Create preview object for this stream
MGCORELib.CoMGPreviewClass preview = new MGCORELib.CoMGPreviewClass();
 
//Enable video preview
preview.EnableAudio(0, 0);
preview.EnableVideo(0, 1);
 
//Set panel for this preview
preview.SetOutputWindow(0, panelStream1.Handle.ToInt32(), 0);
 
//Initialize preview object
preview.Init(mgObj, "stream 1 preview");
 
//Start preview object
preview.Start(0);
Personal tools