You are hereBlogs / alif's blog / Akamai CDN: Getting RTMP URL From XML File

Akamai CDN: Getting RTMP URL From XML File


By alif - Posted on 03 June 2009

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:

1. 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]/
2. 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:


  cp49576.edgefcs.net
  cp49576.edgefcs.net
  ondemand
  
    flash/streamfile/.uid.ManyRzefr9384ec84.anti
   
   false
   2

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:

  1. rtmp://cp49576.edgefcs.net/ondemand/flash/streamfile/.uid.ManyRzefr9384ec84.anti

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;

In popular FLash player like JWPlayer, to play the RTMP URL (for JWPlayer 4.0), the URL would be like this:

  1. player.addVariable('flashvars', 'file=rtmp://cp49576.edgefcs.net/ondemand/flash/streamfile/.uid.ManyRzefr9384ec84.anti');

For JWPlayer 4.5, the 'streamer', 'file' and 'type' needs to be passed separately, so, its slightly different, and would be like this:

  1. player.addVariable("file","flash/streamfile/.uid.ManyRzefr9384ec84.anti");
  2. player.addVariable('streamer', 'rtmp://cp49576.edgefcs.net/ondemand' );
  3. player.addVariable('type', 'rtmp');

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.

Tags

Качественный ремонт киев только тут

You can go those
sits to know more relate things.
prada store

Thank you so much. I spent hours searching for this and finally found this..

Excellent!. Its now posted on stream-recorder.com

http://stream-recorder.com/forum/akamai-cdn-getting-rtmp-url-xml-file-t4...

Thanks,

Good work. This is just what I needed.

Damien, Brazil.

How i can get XML file or RTMP URL ? Help PLS

Это сообщение появилось, потому что в вашем обозревателе отключена поддержка JavaScript. Наш сайт широко использует технологию JavaScript поэтому, чтобы правильно просматривать наши страницы, мы просим Вас включить в обозревателе поддержку Javascript. Как это можно сделать в вашей версии обозревателя, Вы можете узнать

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.