Prefetch

From A-SMIL.org
Jump to: navigation, search

Media files used in SMIL are loaded "on-the-fly" as they are used for the first time. After they are played once, they are kept in the cache storage. Unless storage runs out, media files are played from the cache storage when they are played subsequently.

The downside of this mechanism is that when large media files are used for the first time (e.g., movies), there is a visible gap waiting for the first download to complete. The player seems "frozen" while waiting for download to complete.

A mechanism exists in SMIL to "pre-load" the cache with a file that will be needed later on in advance, in a controlled fashion. This makes use of the SMIL "prefetch" tag.

Contents

Prefetching a file

The following SMIL code segment loads "movie.mpg" into the cache without playing it.

  <prefetch src="http://server/movie.mpg" />

Usually it is used while media is played in foreground. See sample code in the section below.

Prefetching a file seamlessly

  <par>
 
    <seq end="__prefetchEnd.endEvent">
      <seq repeatCount="indefinite">
        <!-- Play waiting prompt or media files that are already in the cache -->
        <video src="http://server/old1.mpg" />
        <video src="http://server/old2.mpg" />
        <video src="http://server/old3.mpg" />
      </seq>
    </seq>
 
    <seq>
      <!-- Load files while first loop plays -->
      <prefetch src="http://server/new1.mpg" />
      <prefetch src="http://server/new2.mpg" />
      <prefetch src="http://server/new3.mpg" />
 
      <!-- Special item that sends out the __prefetchEnd.endEvent event when it ends -->
      <seq id="__prefetchEnd" dur="1s"/> 
    </seq>
 
    <seq begin="__prefetchEnd.endEvent" repeatCount="indefinite">
      <!-- Play loaded files -->
      <video src="http://server/new1.mpg" />
      <video src="http://server/new2.mpg" />
      <video src="http://server/new3.mpg" />
    </seq>
 
  </par>

This example uses several SMIL techniques. 3 sequences are run inside a parallel time container. The first two sequences begin immediately (using default value of begin as "0s").

The first sequence plays whatever waiting message the user wishes to display, until it is ended by the "endEvent" event sent as "__prefetchEnd" sequence finishes (from within the second sequence; 1 second after prefetch completes). Note that there are two <seq> layers as SMIL does not allow an "end" condition to be specified with "repeatCount", which potentially results in ambiguity.

The second sequence contains all prefetch instructions having the last item being the empty sequence named "__prefetchEnd", whose endEvent stops the first sequence (ending the display of waiting messages).

Please note the prefetch sequence should not be placed in a indefinite loop without proper configuration, if content update is necessary, follow the suggestion in best practice

Fixed_Playlist,_Dynamic_Content.


The third sequence starts by the same event that ends the first sequence, and plays media files downloaded by the prefetch sequence.

MD5 Check

SMIL player can do MD5 check while prefetch media.

While MD5 mismatch :


(1) media will be abandoned

(2) player will report checksum error in Player_events


  <prefetch src="foo.wmv">
            <param name="md5" value="F94C9F475265682756530E670F27FC37" />           
  </prefetch>


Applicable device :
IAdea XMP-3250 series player ( firmware 3.4 or higher ) and XDS-1950/2450 signboard
IAdea XMP-2200 series player ( firmware 4.8 or higher ) and XDS-1060 series signboar


Related