Share via


IWMEncSource.PreviewCollection

Windows Media Encoder SDK banner art

The PreviewCollection property retrieves a collection of preview objects for the source stream.

Syntax

IWMEncDataViewCollection = IWMEncSource.PreviewCollection;

Parameters

This property takes no parameters.

Property Value

An IWMEncDataViewCollection object, which is a collection of preview objects.

Remarks

This property is read-only. A preview is a WMEncDataView object that renders content in a window before compression.

To display previews and postviews, you must add the Windows Media Encoder Preview Control reference to the project. For more information, see Programming in C#.

Example Code

using WMEncoderLib;

try
{
// Create a WMEncoder object.
  WMEncoder Encoder;
  Encoder = new WMEncoder();

// Configure the encoding session including the input sources,
// the profile, and the output.

// Retrieve an IWMEncDataViewCollection object from the
// video source object to display a preview.
  IWMEncDataViewCollection DVColl_Preview;
  DVColl_Preview = SrcVid.PreviewCollection;

// Create a WMEncDataView object.
  WMEncDataView Preview;
  Preview = new WMEncDataView();

// Add the WMEncDataView object to the collection.
  int lPreviewStream;
  lPreviewStream = DVColl_Preview.Add(Preview);

// Start encoding.
  Encoder.Start();

// Display the Preview in a panel named PreviewPanel.
  Preview.SetViewProperties(lPreviewStream, (int)PreviewPanel.Handle);
  Preview.StartView(lPreviewStream); 
}

catch (Exception e)
{
     // TODO: Handle exceptions.
}

Requirements

Reference: Windows Media Encoder

Namespace: WMEncoderLib

Assembly: Interop.WMEncoderLib.dll

Library: WMEncoderLib.dll

See Also