Share via


MediaChapter Class

Represents the position of a chapter in a media source.

Namespace:  System.Web.UI.SilverlightControls
Assembly:  System.Web.Silverlight (in System.Web.Silverlight.dll)

Syntax

'Declaration
Public Class MediaChapter _
    Implements IStateManager
'Usage
Dim instance As MediaChapter
public class MediaChapter : IStateManager

Remarks

A chapter is a position in time in an audio or video media file. A chapter can optionally have a title and a thumbnail. The thumbnail, if present, is displayed on some MediaPlayer skins.

For many media player skins, the thumbnails representing the chapters for the media file appear when the user moves the pointer over a specific area on the playback area. When a user clicks on a thumbnail image for a chapter, playback jumps to the starting position of that chapter.

Chapters can be encoded in a media file by using a product such as Microsoft Expression Encoder.

Alternatively, chapters can be defined on the MediaPlayer control. In this case, the chapters defined as the Chapters property of MediaPlayer control will be used for any media file that the control plays. The media file played is indicated by the MediaSource property of the MediaPlayer.

A media definition file can be set as the MediaDefinition property of the MediaPlayer control. This file can indicate the media file to play as well as chapter positions for that media file.

If a media definition file contains chapter positions, those values take precedence over any chapters defined for the MediaPlayer control.

At runtime, a Sys.UI.Silverlight.MediaPlayer.chapterStarted client event occurs when a chapter starts playing in the browser. The OnClientChapterStarted property indicates the name of the client script function to call when this event occurs.

A Sys.UI.Silverlight.MediaPlayer.chapterSelected client event occurs when the user clicks a chapter thumbnail to select a chapter during playback. The OnClientChapterSelected property indicates the name of the client script function to call when this event occurs.

Examples

The following example demonstrates how to define MediaChapter objects for the MediaPlayer control.

The chapters defined in the markup code in this example are accessible programmatically using the Chapters property of the MediaPlayer control.

<asp:MediaPlayer runat="server" ID="MediaPlayer1" ScaleMode="Stretch" AutoPlay="true" 
     MediaSource="../media/expressionstudio.wmv" Height="480" Width="640"
     PluginBackground="Black"  MediaSkinSource="../skins/Professional.xaml">
     <Chapters> 
         <asp:MediaChapter ThumbnailSource="../media/MarkerThumb 00.00.00.jpg" 
          Position="0.0" Title="Chapter 1" /> 
         <asp:MediaChapter ThumbnailSource="../media/MarkerThumb 00.00.10.jpg" 
          Position="10" Title="Chapter 2" /> 
         <asp:MediaChapter ThumbnailSource="../media/MarkerThumb 00.00.24.jpg" 
          Position="24" Title="Chapter 3" /> 
     </Chapters> 
 </asp:MediaPlayer>
<asp:MediaPlayer runat="server" ID="MediaPlayer1" ScaleMode="Stretch" AutoPlay="true" 
     MediaSource="../media/expressionstudio.wmv" Height="480" Width="640"
     PluginBackground="Black"  MediaSkinSource="../skins/Professional.xaml">
     <Chapters> 
         <asp:MediaChapter ThumbnailSource="../media/MarkerThumb 00.00.00.jpg" 
          Position="0.0" Title="Chapter 1" /> 
         <asp:MediaChapter ThumbnailSource="../media/MarkerThumb 00.00.10.jpg" 
          Position="10" Title="Chapter 2" /> 
         <asp:MediaChapter ThumbnailSource="../media/MarkerThumb 00.00.24.jpg" 
          Position="24" Title="Chapter 3" /> 
     </Chapters> 
 </asp:MediaPlayer>

Inheritance Hierarchy

System.Object
  System.Web.UI.SilverlightControls.MediaChapter

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

See Also

Reference

MediaChapter Members

System.Web.UI.SilverlightControls Namespace

Chapters

OnClientChapterStarted

OnClientChapterSelected

Chapters

Other Resources

Sys.UI.Silverlight.MediaPlayer.chapterStarted Event

Sys.UI.Silverlight.MediaPlayer.chapterSelected Event

Walkthrough: Creating Chapter Markers for the MediaPlayer Control