Cache Control

From A-SMIL.org
Revision as of 10:32, 3 June 2013 by SMIL T.A. (Talk | contribs)

Jump to: navigation, search

A-SMIL features 2 methods , "systemCache" property and "cacheControl" parameter to manage player's playback behavior regarding to player's local cache status.

systemCache

First is systemCache which is defining conditions whether a media item should be played based on the player's local cache. Below example illustrates the usage and condition of systemCache.

Precondition of this example - dummy1.jpg exists in player's local cache by previous successful download , instead dummy2.jpg and dummy3.jpg aren't avaialble from previous download.

<seq repeatCount="indefinite">
  <img src="http://foo.com/dummy1.jpg" dur="7s" />  <!-- play as expected -->
  <img src="http://foo.com/dummy2.jpg" dur="7s" />  <!-- player has no media to play , player wait 7 seconds to play next item -->
  <img src="http://foo.com/dummy3.jpg" dur="7s" systemCache="http://foo.com/dummy3.jpg" /> <!-- player has no media to play
 , player skipped and start next item playback immediately --> 
</seq>

cacheControl

CacheControl parameter is defining conditions regarding which copy to be played , whether from local cache or from server.

A-SMIL defines 3 different cacheControl behavior as below :

  • auto (default)

Play local cached content or stream from the server.

  • onlyIfCached

Content is played only if it is cached locally.

  • noCache

Content is always revalidated with origin server.

Below example illustrates the usage and condition of cacheControl parameter.

Precondition of this example - dummy1.jpg exists in player's local cache by previous successful download, instead dummy2.jpg is not available in cache from previous download.

<seq repeatCount="indefinite">
  <img src="http://foo.com/dummy1.jpg" dur="7s">    <!-- default is auto , player playback from local cache since content already cached -->
  </img>
  <img src="http://foo.com/dummy1.jpg" dur="7s">
	   <param name="cacheControl" value="auto"/>    <!-- player playback from local cache since content already cached -->
  </img>
  <img src="http://foo.com/dummy1.jpg" dur="7s">
	   <param name="cacheControl" value="onlyIfCached"/>  <!-- player playback from local cache since content already cached -->
  </img>  
  <img src="http://foo.com/dummy1.jpg" dur="7s">
	   <param name="cacheControl" value="noCache"/>  <!-- Player download from server again and play, instead of playing from local cache -->
  </img>  
  <img src="http://foo.com/dummy2.jpg" dur="7s">   <!-- player has no local cache content to play from , player wait 7 seconds to play next item -->
		<param name="cacheControl" value="onlyIfCached"/>
  </img>
  </seq>