Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Publishing plug-in sample

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 encoding 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   Is 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   Is called at the start of an encode operation. If this method is thrown, the encoding 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 a null value if it is not required.

PerformPublish   Called from Encoder so the plugin can publish any necessary files..

ProgressEvent   Called as progress is made.

OnProgress   Performs as a progress helper function.

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

LoadUISettings   Loads settings that are tracked per user.

SaveUISettings   Saves settings that are tracked per user.

LoadJobSettings   Loads settings that are tracked per job.

SaveJobSettings   Saves settings that are tracked per job.

NoteNote

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

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

NoteNote

For more information about .NET 3.0 Open Packaging Conventions, see Windows Hardware Developer Central Cc761463.xtlink_newWindow(en-us,Expression.30).png.

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 drop-down 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.

   © 2010 Microsoft Corporation. All rights reserved.
Show:
© 2015 Microsoft