PDA

View Full Version : Akamai CDN: Getting RTMP URL From XML File


any ANONYMOUS forum user
06-22-2009, 02:09 AM
Akamai CDN: Getting RTMP URL From XML File

Where I work, my company uses Akamai as the CDN for all properties. Initially our company used non-RTMP downloadable URL from Akamai, but, later after some struggling (in May 2008 or so) I was able to figure out how to extract RTMP from Akamai's XML File.

Akamai Provides two URLs for each File:

Downloadable FLV URL
Returns the actual FLV File. The URL Format of this file is:
http://[your_company_name].edgeboss.net/download/[your_company_name]/[path_to_file]/
Streaming URL
Returns an XML File. The URL Format of this file is:
http://[your_company_name].edgeboss.net/flash/[your_company_name]/[path_to_file]/


#1 is self-explanatory, when you visit that URL, you get the RAW FLV File. so, I will talk on #2.

#2. Streaming URL: When you try visiting the streaming URL. It returns an XML File like below:
<FLVPlayerConfig>
<serverName>cp49576.edgefcs.net</serverName>
<fallbackServerName>cp49576.edgefcs.net</fallbackServerName>
<appName>ondemand</appName>
<streamName>
flash/streamfile/.uid.ManyRzefr9384ec84.anti
</streamName>
<isLive>false</isLive>
<bufferTime>2</bufferTime>
</FLVPlayerConfig>

To get the RTMP URL, all you need to do is concat the node value of serverName, appName and streamName. That's it. So, basically:
rtmp://[serverName]/[appName]/[streamName]

So, for the above case, the rtmp URL would be:
rtmp://cp49576.edgefcs.net/ondemand/flash/streamfile/.uid.ManyRzefr9384ec84.anti

Now the above RTMP URL can be used on popular Flash Players like JWPlayer.

I usually use PHP DomDocument and DomXPath to get the RTMP URL. The code would be simple and straight-forward like below:
$dom = new DomDocument($akamaiURL);
$xpath = new DomXPath($dom);

$rtmpURL = 'rtmp://'.$xpath->query('/FLVPlayerConfig/serverName')->item(0)->nodeValue .'/'. $xpath->query('/FLVPlayerConfig/appName')->item(0)->nodeValue . '/' . $xpath->query('/FLVPlayerConfig/streamName')->item(0)->nodeValue;

I hope it helps.

Please Note that: In this article, I didn't cover the Akamai URL that requires Authentication Token, which is a separate issue.

markitoxs
08-08-2009, 01:29 PM
Hello,

Could you please point me in some direction regarding the Akamai Authentication system?

From my limited understanding, does the player make an http request with the token as a string id, and then receives the url for the RTMP? How does this URL differ from the XML method mentiones above?

Thank you very much for your time.

hetchel
10-22-2009, 11:07 AM
THAAAAAAAAAANK YOU VERY MUCH!
I was obtaining the 2nd type url. I tried to change "flash" to "download", to obtain the 1st one, and with that simple trick, I'm able to directly download the videos.
I had tried a lot of programs and tricks in order to download the videos, and a simple advice solves everything ;)
THANKS, THANKS, THANKS AND THANKS AGAIN.