Microsoft Producer for PowerPoint 2003 SDK banner art
PreviousNext

Displaying Profile Information

The following sample code creates a Web page that is displayed in the hosted browser window that is the custom user interface in the Microsoft Producer Publish Wizard. This sample illustrates how to use the Producer object model to display information about the available publishing profiles.

<!--
**************************************************
**  This is a sample of a custom user interface **
**  HTML document. This sample displays a list  **
**  of all available profiles and their         **
**  properties.                                 **
**************************************************
-->
<HTML>
<BODY>

<SCRIPT language="JScript">
// Get the ProfileManager object.
var ProfileMgr = window.external.ProfileManager;
// Get the number of Profile objects in the ProfileManager.
var ProfileCount = ProfileMgr.Count;
// Create some variables to hold the Profile and StreamConfig indexes.
var ProfileIndex, StreamIndex;

// Iterate through all available Profile objects.
for (ProfileIndex = 0; ProfileIndex < ProfileCount; ProfileIndex++) {
   // Get the next Profile.
   var Profile = ProfileMgr.Item(ProfileIndex);
   // Check to see whether it's a publish profile, and skip it if it isn't.
   if (!Profile.IsPublishProfile) continue;
   // Get the number of StreamConfig objects in this Profile.
   var StreamCount = Profile.Count;
   // Display the properties of this Profile.
   document.write("<H1>" + Profile.Name + "</H1>");
   document.write("<H3>ProfileID (GUID) = " + Profile.ProfileID + "</H3>");
   document.write("<I>" + Profile.Description + "</I><BR><BR>");
   document.write("TotalBitrate = " + Profile.TotalBitrate + "<BR>");
   document.write("AudioStreamCount = " + Profile.AudioStreamCount + "<BR>");
   document.write("VideoStreamCount = " + Profile.VideoStreamCount + "<BR>");
   document.write("Count = " + StreamCount + "<BR>");

   document.write("IsAudioProfile = " + (Profile.IsAudioProfile?"yes":"no") + "<BR>");
   document.write("IsVideoProfile = " + (Profile.IsVideoProfile?"yes":"no") + "<BR>");

   /* The properties that determine quality don't actually determine the 
      quality of the profile. These properties test whether the profile is one 
      of the Producer standard profiles of the particular quality type. */
   document.write("IsLowQuality = " + (Profile.IsLowQuality?"yes":"no") + "<BR>");
   document.write("IsMediumQuality = " + (Profile.IsMediumQuality?"yes":"no") + "<BR>");
   document.write("IsHighQuality = " + (Profile.IsHighQuality?"yes":"no") + "<BR>");
   // Display a heading for the StreamConfig section, and indent its contents.
   document.write("<BR><H2>StreamConfigs</H2><BLOCKQUOTE>");
   // Iterate through all available StreamConfig objects in this Profile.
   for (StreamIndex = 0; StreamIndex < StreamCount; StreamIndex++) {
      // Get the next StreamConfig.
      var Stream = ProfileMgr.Item(ProfileIndex).Item(StreamIndex);
      // Display the properties of this StreamConfig.
      document.write("<H3>" + Stream.Name + "</H3>");
      document.write("BitRate = " + Stream.BitRate + "<BR>");
      document.write("BitsPerSample = " + Stream.BitsPerSample + "<BR>");
      document.write("BufferWindow = " + Stream.BufferWindow + "<BR>");
      document.write("ChannelCount = " + Stream.ChannelCount + "<BR>");
      document.write("ConnectionName = " + Stream.ConnectionName + "<BR>");
      document.write("FramesPerSecond = " + Stream.FramesPerSecond + "<BR>");
      document.write("MaxKeyFrameSpacing = " + Stream.MaxKeyFrameSpacing + "<BR>");
      document.write("MediaType = " + Stream.MediaType + "<BR>");
      document.write("Number = " + Stream.Number + "<BR>");
      document.write("Quality = " + Stream.Quality + "<BR>");
      document.write("SampleSize = " + Stream.SampleSize + "<BR>");
      document.write("SamplesPerSecond = " + Stream.SamplesPerSecond + "<BR>");
      // Test whether it's a video profile. 
      // BitCount, VideoHeight, and VideoWidth are only applicable to video.
      if (Profile.IsVideoProfile) {
         document.write("BitCount = " + Stream.BitCount + "<BR>");
         document.write("VideoHeight = " + Stream.VideoHeight + "<BR>");
         document.write("VideoWidth = " + Stream.VideoWidth + "<BR>");
      }
   }
   // End the indented block.
   document.write("</BLOCKQUOTE>");
}
</SCRIPT>

</BODY>
</HTML>
PreviousNext


© 2001-2003 Microsoft Corporation. All rights reserved.