Publishing plug-in

Publishing plug-ins enables you to take video and Microsoft Silverlight template assets that you have created as part of an encoding job and then do something with encoded assets. For example, you can upload the media asset by using FTP, WEBDAV, or METAWEBLOG API, publishing the asset to an asset management system or web service, or creating a data CD.

The following code sample demonstrates how to use a publishing plug-in to add the output of an encode job to a Zip file by using the Open Packaging Convention components found in Microsoft .NET 3.0.

A publishing plug-in is required to derive from the PublishPlugin class, which in turn derives from the EncoderPlugin class:

public abstract class EncoderPlugin : MarshalByRefObject
{
      public void InitPublishingHost(IPluginHost host);
      protected IPluginHost PublishingHost{get;}
      public virtual void OnEncodeStart(JobBase job, MediaItem[] items)
}

InitPublishingHost   Called from the user interface (UI) to set the publishing host (called only from the Microsoft Expression Encoder UI).

PublishingHost   Returns the current publishing host or null if the parameter is not set.

OnEncodeStart   Called at the start of an encode operation. If this method throws, the encode operation will be canceled and an error message will appear.

public abstract class PublishPlugin : EncoderPlugin
{
    public abstract Object CreateStandardSettingsEditor();
    public abstract Object CreateAdvancedSettingsEditor();
    public abstract void PerformPublish(string rootPath, string[] filesToPublish);
    public event EventHandler<ProgressEventArgs> ProgressEvent;
    protected void OnProgress(string description, double progress);
    protected virtual void CancelPublish()
    public virtual void LoadUISettings(XmlReader reader)
    public virtual void SaveUISettings(XmlWriter writer)
    public virtual void LoadJobSettings(XmlReader reader)
    public virtual void SaveJobSettings(XmlWriter writer)
}

CreateStandardSettingsEditor   Creates the standard UI that the plug-in needs.

CreateAdvancedSettingsEditor   Creates the advanced UI or returns null if it is not required.

PerformPublish   Publish on this thread.

ProgressEvent   Progress event.

OnProgress   Progress helper function.

CancelPublish   Protected function that is called when cancel is set in progress.

LoadUISettings   Load settings that are tracked per user.

SaveUISettings   Save settings that are tracked per user.

LoadJobSettings   Load settings that are tracked per job.

SaveJobSettings   Save settings that are tracked per job.

Note

CreateStandardSettingsEditor, CreateAdvancedSettingsEditor, and PerformPublish are required to be implemented by the plug-in.

The code sample also shows how to persist settings in the Job file by overriding LoadJobSettings and SaveJobSettings.

Note

For more information about .NET 3.0 Open Packaging Conventions, see Windows Hardware Developer Central.

To run the PublishPlugin sample

  1. Build the code sample.

  2. Copy the built plug-in DLL in the Expression Encoder Plugins directory.

  3. Open Expression Encoder.

  4. Import a media file by clicking Import and then selecting a media file.

  5. Click the Output tab. On the Job Output pane, select a template from the Template dropdown list.

  6. On the Output tab, in the Publish pane, click Zip Plugin from scratch in the Publish To drop-down list.

  7. Click Encode.

  8. When the encoding ends, the Publish option will be available. Click Publish to create a Zip file that contains the media you just encoded on your desktop.

See also

Other resources

Expression Encoder 2 SDK