Share via


TrackInfo.EndGetChunk Method

Method to complete the action of BeginGetChunk.

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

Syntax

'Declaration

Public Overridable Function EndGetChunk ( _
    ar As IAsyncResult _
) As ChunkResult
'Usage

Dim instance As TrackInfo
Dim ar As IAsyncResult
Dim returnValue As ChunkResult

returnValue = instance.EndGetChunk(ar)
public virtual ChunkResult EndGetChunk(
    IAsyncResult ar
)
public:
virtual ChunkResult^ EndGetChunk(
    IAsyncResult^ ar
)
abstract EndGetChunk : 
        ar:IAsyncResult -> ChunkResult 
override EndGetChunk : 
        ar:IAsyncResult -> ChunkResult 
public function EndGetChunk(
    ar : IAsyncResult
) : ChunkResult

Parameters

Return Value

Type: Microsoft.Web.Media.SmoothStreaming.ChunkResult
A ChunkResult object.

Examples

The following example loops through tracks and calls the EndGetChunk(IAsyncResult) method on each track. This method completes an asynchronous process started by BeginGetChunk(TimeSpan, AsyncCallback, Object). The ChunkResult indicates success or failure. If the method succeeds, the ChunkResult contains the Base64-encoded data. For the complete example and more information, see Timeline Markers and Events.

    foreach (TrackInfo trackInfo in streamInfo.SelectedTracks)
    {
        ChunkResult chunkResult = trackInfo.EndGetChunk(argAR);

        if (chunkResult.Result == ChunkResult.ChunkResultState.Succeeded)
        {
            System.Text.Encoding enc = System.Text.Encoding.UTF8;
            int length = (int)chunkResult.ChunkData.Length;
            byte[] rawData = new byte[length];
            chunkResult.ChunkData.Read(rawData, 0, length);
            String text = enc.GetString(rawData, 0, rawData.Length);
            TimelineMarker newMarker = new TimelineMarker();
            newMarker.Text = text;
            newMarker.Time = chunkResult.Timestamp;

            SmoothPlayer.Markers.Add(newMarker);
        }
    }

Version Information

Silverlight

Supported in: 5

See Also

Reference

TrackInfo Class

Microsoft.Web.Media.SmoothStreaming Namespace