<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Flash Remoting for Ruby on Rails &#187; Streaming</title>
	<atom:link href="http://blog.rubyamf.org/category/streaming/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.rubyamf.org</link>
	<description>Ruby AMF - Flash Remoting for Ruby on Rails</description>
	<lastBuildDate>Tue, 25 Aug 2009 12:23:44 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Updating NCManager order of Connection Attempts</title>
		<link>http://blog.rubyamf.org/2008/01/30/updating-ncmanager-order-of-connection-attempts/</link>
		<comments>http://blog.rubyamf.org/2008/01/30/updating-ncmanager-order-of-connection-attempts/#comments</comments>
		<pubDate>Thu, 31 Jan 2008 06:18:23 +0000</pubDate>
		<dc:creator>aaron</dc:creator>
				<category><![CDATA[Streaming]]></category>

		<guid isPermaLink="false">http://blog.rubyamf.org/?p=106</guid>
		<description><![CDATA[I&#8217;ve been working a lot lately with Akamai for streaming content. Minus many problems I&#8217;ve encountered, and having to write an AS3 AkamaiNCManager class. It&#8217;s pretty straight forward.
For a quick background on the what I&#8217;m going to show you &#8211; checkout the FLVPlayback documentation and look at the ncMgr property. Then read about the INCManager [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working a lot lately with Akamai for streaming content. Minus many problems I&#8217;ve encountered, and having to write an AS3 AkamaiNCManager class. It&#8217;s pretty straight forward.</p>
<p>For a quick background on the what I&#8217;m going to show you &#8211; checkout the FLVPlayback documentation and look at the ncMgr property. Then read about the INCManager and NCManager. If you read the source code of the NCManager class, it&#8217;s pretty straightforward, and you can see that attempts to connect to your streaming application are made numerous times, first to port 1935, then to port 443, then to port 80 over RTMPT (http tunneling), then to port 443, over RTMPS.</p>
<p>That&#8217;s quite a few connection attempts to go through, which can cause delays in streams playing. Generally it&#8217;s not really a big deal. But in this case &#8211; a pretty serious application, I don&#8217;t want my apps attempting all of those, or just in that order.</p>
<p>Preferably I&#8217;d rather have it first check RTMPT over port 80, because port 80 is always open. Then check port 1935, then 443.  It was pretty straight forward after diving into it a bit. I thought I&#8217;d share how to re-order the way that the NetConnection&#8217;s are attempted in the default NCManager class.</p>
<p>First thing, we need to update the AS3 source NCManager class. Find that source file, and open it up. There is a variable declared like so:</p>
<pre>

//ORIGINAL:
flvplayback_internal static const RTMP_CONN:Array = [
{ protocol: "rtmp:/", port:"1935" }
,{ protocol: "rtmp:/", port:"443" }
,{ protocol: "rtmpt:/", port:"80" }
,{ protocol: "rtmps:/", port:"443" }
];

//UPDATED:
flvplayback_internal static var RTMP_CONN:Array = [
{ protocol: "rtmp:/", port:"1935" }
,{ protocol: "rtmp:/", port:"443" }
,{ protocol: "rtmpt:/", port:"80" }
,{ protocol: "rtmps:/", port:"443" }
];
</pre>
<p>All I did here is update it so that it&#8217;s not constant, it&#8217;s now a var. Note that instead of changing the value of the variable in your class, just change it from const to var. So that in other flash applications, you don&#8217;t inherit something in the AS3 codebase you forgot about.</p>
<p>So now to update the variable:</p>
<pre>
package
{

  use namespace flvplayback_internal;

  public class MySomething
  {
     public function MySomething()
     {
         //change the values.
         NCManager.flvplayback_internal::RTMP_CONN = [
           {protocol: "rtmpt:/", port:"80" },
           {protocol: "rtmp:/", port:"1935"},
           {protocol: "rtmp:/", port:"443"}
         ]
     }
  }
}
</pre>
<p>Now you can successfully change the order of connection attempts.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rubyamf.org/2008/01/30/updating-ncmanager-order-of-connection-attempts/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
