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)

public virtual ChunkResult EndGetChunk(
	IAsyncResult ar


Type: System..::..IAsyncResult
An IAsyncResult object from BeginGetChunk.

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 (IIS Smooth Streaming).

    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;



Supported in: 4