StreamInfo.SelectTracks Method

Selects TrackInfo objects for this stream. For more information see Select and Monitor Bitrate.

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


public bool SelectTracks(
	IList<TrackInfo> selectedTracks,
	bool flushBuffer
)

Parameters

selectedTracks
Type: System.Collections.Generic.IList<TrackInfo>
The TrackInfo objects for this stream.
flushBuffer
Type: System.Boolean
A Boolean value that specifies whether to flush buffers.

Return Value

Type: System.Boolean
A Boolean value, true if the method succeeds, otherwise false.

When SelectTracks(IList<TrackInfo>, Boolean) is called during the ManifestReady event, AvailableTracks is restricted to the new set of selected tracks. This allows an application to lock the set of video tracks to those which all have the same resolution. This is useful in Windows Phone applications because Windows Phone cannot decode multi-resolution video content. SelectTracks(IList<TrackInfo>, Boolean) must not be called more than once.

The following example shows how to select tracks from SegmentInfo and StreamInfo objects.

    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);
                    }
                }
            }
        }
    }

Silverlight

Supported in: 5

Windows Phone

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