I've done a quick and dirty proof-of-concept to get Apple Trailers streaming.
I took a look at the semi-working stream from gametrailers and started banging away at transforming the Apple XML to something resembling the gametrailers XML.
I did this by putting writing a simple php file and putting it on my webserver that grabs the apple xml, transforms it (could probably be done simply using an xml stylesheet transform) and post the result.
For some ODD reason it only works when I go into the #Transcode# folder and choose the "mencoder web" version NOT the default videolan (I don't know how to fix my web.conf so it defaults to using mencoder).
Here is the code for the php file used:
parse.php
- Code: Select all
<?php
echo '<?xml version="1.0" encoding="iso-8859-1"?>
<rss version="2.0" xmlns:media="http://purl.org/rss/1.0/modules/content/">
<channel>
<title>Apple Trailers</title>
<link>http://www.gametrailers.com/rssgenerate.php</link>
<description>Gametrailers PS3 - Angelscry 2009</description>
';
?>
<?php
$reader = new XMLReader();
$request = $HTTP_RAW_POST_DATA;
//$reader->XML($request);
$reader->open('http://www.apple.com/trailers/home/xml/current.xml');
while ($reader->read()) // while there is something to read
{
if ($reader->name == "title" && $reader->nodeType == XMLReader::ELEMENT)
{ // Find the title tag
$reader->read(); //step ahead to content
if($reader->hasValue)
{ //Hack out XML
echo "<item>\n\t";
echo "\t<title>" . $reader->value . "</title>\n" ;
echo "\t<media:title>" . $reader->value . "</media:title>\n" ;
}
}
if ($reader->name == "location" && $reader->nodeType == XMLReader::ELEMENT)
{
//This is the thumbnail
$reader->read();
if($reader->hasValue)
{
//echo "<br><img src='" . $reader->value . "'>"; //output image
//echo "<br>".$reader->value;
echo "\t";
echo '<media:thumbnail url="' . $reader->value . '"/>' ;
echo "\n";
}
}
if ($reader->name =="large" && $reader->nodeType == XMLReader::ELEMENT)
{
//This is the link to the .mov file
$reader->read();
if($reader->hasValue)
{
echo "\t";
echo '<link>' . $reader->value . '</link>>';
echo "\n\t";
echo '<media:link>' . $reader->value . '</media:link>>';
echo "\n";
echo "\t<description>Not done yet!</description>\n";
echo "</item>\n";
}
}
}
$reader->close(); //Stop
?>
</channel>
</rss>
I put this file on my webserver and stuck the following in my web.conf
- Code: Select all
videofeed.Web,Apple=http://10.0.0.5/parse.php
I used a feed giving me "standard large" 640x340 format videos which are in the format:
- Code: Select all
http://movies.apple.com/movies/fox/allaboutsteve/allaboutsteve-tlra_h640w.mov
but it appears that the HD version should be available by exchanging the last h640w.mov to
- Code: Select all
http://movies.apple.com/movies/fox/allaboutsteve/allaboutsteve-tlra_720p.mov
or even
- Code: Select all
http://movies.apple.com/movies/fox/allaboutsteve/allaboutsteve-tlra_1080p.mov
I haven't tried this though as my line (8-10-ish mbit downstream) seems to choke, stutter and die when trying to stream HD content.
Hope this might be of help to some of the more adventurous users out there.
/Robotron3000
