Silverlight IIS Smooth Streaming Offline Cache Sample

Windows This is a Community Contributed Download

CategoryServe Media
LicenseFree
Supported by N/A
Works WithIIS 7, IIS 7.5
Documentation N/A
Updated onSeptember 29, 2010
Uploaded bymike dodaro

Overview

This sample demonstrates implementation of ISmoothStreamingCache for the Silverlight IIS Smooth Streaming off-line scenario. The sample demonstrates implementations of the four methods of ISmoothStreamingCache : BeginRetrieve EndRetrieve BeginPersist EndPersist

Features

When an ISmoothStreamingCache object is engaged and a request for data is issued, the Silverlight Smooth Streaming Client will call each of the methods in order: BeginRetrieve, EndRetrieve, BeginPersist, EndPesist.

On the first pass, before the cache has any data, the calls to BeginRetrieve and EndRetrieve return a null CascheResponse object. The application will then call BeginPersist to cache the data for future use as needed for the off-line scenario. The BeginPersist method parses the data returned from the server. If there is enough available storage, the data is stored in IsolatedStorage. When the data has been successfully parsed and persisted, EndPersist returns true.

If BeginPersist and EndPersist have previously run successfully, the cache will already have the required data on a new data request. Instead of making a call to the IIS Server, BeginRetrieve will process, and EndRetrieve will return, a SmoothStreamingAsyncResult that contains a non-null CacheResponse object to be played back by the application instance of SmoothStreamingMediaElement.

As demonstrated in the sample, EndRetrieve must wait for BeginRetrieve to complete by using the ar.AsyncWaitHandle.WaitOne method, and, similarly, EndPersist should wait for BeginPersist to complete.

Benefits

This sample demonstrates use of the ISmoothStreamingCache interface supported by IIS Smooth Streaming Client 1.0 and 1.1. Documentation is available at the at the download location with additional information about debugging cache implementations.

Requirements

To use the sample you will need manifests and multi-bit-rate files on an IIS server. Modify the source urls in the SourceList_SelectionChanged delegate to use working URLs. Default allocation for IsolatedStorage is 1 megabyte, so a small media segment is easiest to use for testing. The cache size can be increased by enabling the button available for this purpose on the UI.