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)

Syntax

'Declaration

Public Function SelectTracks ( _
    selectedTracks As IList(Of TrackInfo), _
    flushBuffer As Boolean _
) As Boolean
'Usage

Dim instance As StreamInfo
Dim selectedTracks As IList(Of TrackInfo)
Dim flushBuffer As Boolean
Dim returnValue As Boolean

returnValue = instance.SelectTracks(selectedTracks, _
    flushBuffer)
public bool SelectTracks(
    IList<TrackInfo> selectedTracks,
    bool flushBuffer
)
public:
bool SelectTracks(
    IList<TrackInfo^>^ selectedTracks, 
    bool flushBuffer
)
member SelectTracks : 
        selectedTracks:IList<TrackInfo> * 
        flushBuffer:bool -> bool 
public function SelectTracks(
    selectedTracks : IList<TrackInfo>, 
    flushBuffer : boolean
) : boolean

Parameters

  • 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.

Remarks

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.

Examples

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

Version Information

Silverlight

Supported in: 5

Windows Phone

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

See Also

Reference

StreamInfo Class

Microsoft.Web.Media.SmoothStreaming Namespace