MediaRSS

From A-SMIL.org
Revision as of 18:26, 2 September 2009 by SMIL T.A. (talk | contribs) (Added SMIL player configuration info)
Jump to: navigation, search

SMIL players (such as the IAdea XMP-300, f/w 1.0.21 or later) support configuring a "Content Source" URL which is loaded at boot time. To make a SMIL player play from an Media RSS feed, simply set up a dynamic script (.aspx, .php, etc.) that takes a Media RSS feed and outputs SMIL, then point your SMIL player to the dynamic script.

One way to convert a media RSS feed into a SMIL feed is to use the PHP XPath library.

<?php

        $doc = new DOMDocument();

        if( $doc->load('http://rss.server.com/mediarssfeed') ) // place your feed here
        {
                $xpath = new DOMXPath($doc);
                $xpath->registerNamespace("media",
                        "http://search.yahoo.com/mrss/");
                $nodes = $xpath->query('/rss/channel/item/media:content',$doc);
                $ttlnode= $xpath->query('/rss/channel/ttl',$doc);

                header( 'Content-Type: application/smil' );

                echo "<smil><head>"
                        .'<layout><root-layout width="1280" height="720"/>'
                        .'</layout><meta http-equiv="Refresh" content="'
                        .$ttlnode->item(0)->textContent * 60
                        .'"/></head>'
                        ."<body><seq repeatCount=\"indefinite\">\r\n" ;

                foreach( $nodes as $node )
                {
                        echo "\t<img src=\""
                                . $node->attributes->getNamedItem('url')
                                ->textContent
                                . "\" dur=\""
                                . $node->attributes->getNamedItem('duration')
                                ->textContent
                                . "\" />\r\n" ;
                }

                echo '</seq></body></smil>' ;
        }

?>