ManifestInfo.Segments Property

List of SegmentInfo objects. There is a SegmentInfo for each <Clip> element in the manifest.

Namespace:  Microsoft.Web.Media.SmoothStreaming
Assembly:  Microsoft.Web.Media.SmoothStreaming (in Microsoft.Web.Media.SmoothStreaming.dll)

Syntax

'Declaration

Public Property Segments As IList(Of SegmentInfo)
    Get
    Private Set
'Usage

Dim instance As ManifestInfo
Dim value As IList(Of SegmentInfo)

value = instance.Segments
public IList<SegmentInfo> Segments { get; private set; }
public:
property IList<SegmentInfo^>^ Segments {
    IList<SegmentInfo^>^ get ();
    private: void set (IList<SegmentInfo^>^ value);
}
member Segments : IList<SegmentInfo> with get, private set
function get Segments () : IList<SegmentInfo>
private function set Segments (value : IList<SegmentInfo>)

Property Value

Type: System.Collections.Generic.IList<SegmentInfo>
Generic list of SegmentInfo objects.

Remarks

The AvailableStreams property of the SegmentInfo object contains a collection of StreamInfo objects. The SelectedStreams property must include exactly one video stream and one audio stream. Non-audio/video streams do not have this restriction and can be multiply selected and deselected. The streams in the list must be members of the current segment’s AvailableStreams or SelectedStreams property. To generate the lists of available streams or selected streams use a List<T>.CopyTo constructor of type StreamInfo to copy either the AvailableStreams or the SelectedStreams property. Add or remove streams until you have the desired list.

You will get notifications for de-selection of current streams followed by selection of new ones. All de-selection notifications will arrive before selection notifications on a per-segment basis. This allows you to clean up any state associated with the deselected stream before adding state associated with the new stream. However, due to the possibility of multiple segments, it is preferable to use the UniqueId property to identify any objects that are associated with a stream.

Examples

The following example shows how to get SegmentInfo and StreamInfo objects from the ManifestInfo object.

    void SmoothPlayer_ManifestReady(object sender, EventArgs e)
    {
        if (!PremiumAccount)
        {
            foreach (SegmentInfo segment in SmoothPlayer.ManifestInfo.Segments)
            {
                IList<StreamInfo> streamInfoList = segment.AvailableStreams;
                foreach (StreamInfo stream in streamInfoList)
                {
                    if (stream.Type == MediaStreamType.Video)
                    {
                        // Limit bit-rate to 866000.
                        ulong highRate = 866000 + 1;
                        List<TrackInfo> tracks = new List<TrackInfo>();

                        tracks = stream.AvailableTracks.ToList<TrackInfo>();
                        IList<TrackInfo> allowedTracks = tracks.Where((ti) => ti.Bitrate < highRate).ToList();
                        stream.SelectTracks(allowedTracks, false);
                    }
                }
            }
        }
    }

Version Information

Silverlight

Supported in: 5

Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

See Also

Reference

ManifestInfo Class

Microsoft.Web.Media.SmoothStreaming Namespace