Difference between revisions of "Currency Table"

From A-SMIL.org
Jump to: navigation, search
Line 1: Line 1:
 
== Summary ==
 
== Summary ==
 
This sample implements a live currency exchange chart.The live currency data is obtained from internet resource using PHP programming.
 
This sample implements a live currency exchange chart.The live currency data is obtained from internet resource using PHP programming.
Fixed playlist , dynamic content – SMIL skill has been used to update the live currency data to the SMIL player.
+
[[Fixed_Playlist,_Dynamic_Content]]– SMIL skill used here to update the live currency data to the SMIL player.
Reference :  [[Fixed_Playlist,_Dynamic_Content]]
+
 
+
 
+
 
== Obtain live currency data from web ==
 
== Obtain live currency data from web ==
There are plenty currency resource avaliable over internet, this sample grab currency data from [http://www.cnbc.com/id/24509219 CNBC].
+
There are plenty currency resource available over internet, this sample grab currency data from [http://www.cnbc.com/id/24509219 CNBC].
 
[http://simplehtmldom.sourceforge.net/ Open source dom parser] used here to parse the currency data from the web page:
 
[http://simplehtmldom.sourceforge.net/ Open source dom parser] used here to parse the currency data from the web page:
 +
<source lang="php">
 +
//snapshot from the php code
 +
include_once('simple_html_dom.php'); // include dom parser
 +
$html = file_get_html('http://www.cnbc.com/id/24509219'); // assign source
 +
$currency[$x]=$html->find('div[align=right]',$x)->plaintext; // find the currency element
 +
</source>
  
  
 +
== Fixed playlist , dymamic content  ==
 +
The live currency data will be save as PNG image, player will update the image every 60 seconds.
 +
<source lang="smil">
 +
    <par repeatCount="indefinite">
 +
        <seq dur="60s" /> <!-- refresh interval -->
 +
        <seq>
 +
          <prefetch src="currency1.png" />
 +
          <prefetch src="currency2.png" />
 +
          <prefetch src="currency3.png" />
 +
          <prefetch src="currency4.png" />
 +
          <prefetch src="currency5.png" />
 +
          <prefetch src="currency6.png" />
 +
          <prefetch src="currency7.png" />
 +
          <prefetch src="currency8.png" />  
 +
          <prefetch src="currency9.png" />
 +
        </seq>
 +
    </par>
 +
</source>
  
  

Revision as of 06:21, 12 February 2011

Summary

This sample implements a live currency exchange chart.The live currency data is obtained from internet resource using PHP programming. Fixed_Playlist,_Dynamic_Content– SMIL skill used here to update the live currency data to the SMIL player.

Obtain live currency data from web

There are plenty currency resource available over internet, this sample grab currency data from CNBC. Open source dom parser used here to parse the currency data from the web page:

//snapshot from the php code
include_once('simple_html_dom.php'); // include dom parser
$html = file_get_html('http://www.cnbc.com/id/24509219'); // assign source
$currency[$x]=$html->find('div[align=right]',$x)->plaintext; // find the currency element


Fixed playlist , dymamic content

The live currency data will be save as PNG image, player will update the image every 60 seconds.

    <par repeatCount="indefinite">
        <seq dur="60s" /> <!-- refresh interval -->
        <seq>
          <prefetch src="currency1.png" />
          <prefetch src="currency2.png" />
          <prefetch src="currency3.png" />
          <prefetch src="currency4.png" />
          <prefetch src="currency5.png" />
          <prefetch src="currency6.png" />
          <prefetch src="currency7.png" />
          <prefetch src="currency8.png" />		  
          <prefetch src="currency9.png" />	
        </seq>
    </par>









Download Full Sample