Fixed Playlist, Dynamic Content

From A-SMIL.org
Revision as of 07:32, 3 November 2010 by SMIL T.A. (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

There may be very simple digital signage use cases where the playlist stays the same (looping through the same file name links) but the user wishes to be able to quickly update the playback by replacing media files at the URLs. SMIL can easily accommodate that.

Precaution

When using the following technique, make sure you update the media on the file server using an "atomic" file update operation such as the Windows "move" or the Linux "mv" command. If not handled carefully, the following technique can cause partially updated files to be played if the file server serves partially completed files while they are being uploaded.

Use Case

Suppose you want to play a simple loop containing a JPEG picture and a video only, and you want to update the media files (when needed) simply by changing the media files themselves without modifying the playlist.

The Solution

You can accomplish the tasking using the following SMIL script:

<smil>
  <head />
  <body>
    <par>
 
      <!-- the Playlist block -->
      <seq repeatCount="indefinite">
        <img src="http://server/sign1.jpg" dur="5s">
          <param name="cacheControl" value="onlyIfCached" />
        </img>
        <video src="http://server/sign2.mpg">
          <param name="cacheControl" value="onlyIfCached" />
        </video>
      </seq>
 
      <!-- the Check-for-Update block -->
      <par repeatCount="indefinite">
        <seq dur="60s" /> <!-- specify refresh interval here -->
        <seq>
          <prefetch src="http://server/sign1.jpg" />
          <prefetch src="http://server/sign2.mpg" />
        </seq>
      </par>
 
    </par>
  </body>
</smil>

Note that a line of "cacheControl" parameter is added to every item in the playlist so that when new versions of the media file is detected, the old version is played until the new one is completely loaded in cache.

The second block checks every 60 seconds (can be modified as needed) for changes in the media files listed in this block. If a change is detected, the new file is loaded in the background and automatically played in the first block when it is completed loaded in cache.

Related

  • Smooth Updates for updating playback when the playlist (SMIL file) changes