Comunidad de diseño web y desarrollo en internet online

problemas de deteccion de ancho de banda flash media server

Citar            
MensajeEscrito el 19 Nov 2010 04:22 pm
Estimados
necesito detectar en ancho de banda de las conexiones de internet con flash media server.
con flex o flash
pero lo e implementado en ambos y ninguno de ellos me funciona como lo puedo hacer
aqui les dejo el codigo


archivo bandwidthtest.as

Código ActionScript :

package com.bitratesample.document
{
   import com.bitratesample.event.BandwidthEvent;
   import com.bitratesample.net.SimpleClient;
   import fl.controls.TextArea;
   import flash.display.MovieClip;
   import flash.net.NetConnection;
   import flash.events.NetStatusEvent;
   import flash.events.SecurityErrorEvent;
   import flash.events.IOErrorEvent;

   public class BandwidthTest extends MovieClip
   {
      public var output_txt:TextArea;
      
      public var rtmpPath:String = "rtmp://localhost/test1/aaa";
      
      private var _client:SimpleClient;
      private var _nc:NetConnection;
      
      public function BandwidthTest() 
      {
         // Create the client
         _client = new SimpleClient();
         
         // Add the listener for the bandwidth result
         _client.addEventListener( BandwidthEvent.BANDWIDTH_RECEIVED, _onBandwidthReceived );
         
         // Create our net connection
            _nc = new NetConnection();
         
         // set the client on the NetConnection
         _nc.client = _client; 
            
         // Create our listeners for the NetConnection
         _nc.addEventListener( NetStatusEvent.NET_STATUS, _onNetStatus );
            
         // Connect
         _nc.connect( rtmpPath, true );
      }
      
      private function log( p_msg:String ):void
      {
         trace( p_msg );
         output_txt.appendText( p_msg + "\n" );
      }
      
      // Event handler for Bandwidth event
      private function _onBandwidthReceived( p_event:BandwidthEvent ):void
      {
         log( "Now we know our bandwidth!" );
         log( "Bandwidth: " + p_event.bandwidth );
      }
      
      private function _onNetStatus( p_event:NetStatusEvent ):void
        {
         log( "p_event.info.code: " + p_event.info.code );
            switch( p_event.info.code )
            {
                case "NetConnection.Connect.Success":
            {
                   log( "The connection attempt succeeded." );
               break;
                }
            case "NetConnection.Connect.Rejected":
               {
               log( "The connection attempt did not have permission to access the application." );
                   break;
            }
               case "NetConnection.Connect.Failed":
            {
               trace( "The connection attempt failed." );
               break;
            }
           }
        }
      
   }
   
}



archivo simpleClient.as

Código ActionScript :

package com.bitratesample.net 
{
   import com.bitratesample.event.BandwidthEvent;
   import flash.events.EventDispatcher;

   public class SimpleClient extends EventDispatcher
   {
      
      public function SimpleClient() 
      {
         
      }
      
      public function onBWCheck( ... rest ):Number 
      {
         return 0;
      }
         
      public function onBWDone( ... rest ):void 
      {
         // Create a local bandwidth variable
         var bitrate:Number;
         
         // Get the bandwidth value from the rest array
         bitrate = rest[0];
         trace(bitrate);
         // Dispatch an event and pass the bandwidth value 
         dispatchEvent( new BandwidthEvent( BandwidthEvent.BANDWIDTH_RECEIVED, bitrate ) );
      }
      
   }
   
}


archivo bandwidthevent.as

Código ActionScript :

package com.bitratesample.event 
{
   import flash.events.Event;

   public class BandwidthEvent extends Event
   {
      static public var BANDWIDTH_RECEIVED:String = "bandwidthReceived";
      
      public var bandwidth:int;
      
      public function BandwidthEvent( p_type:String, p_bandwidth:int, p_bubbles:Boolean=false, p_cancelable:Boolean=false ) 
      {
         super( p_type, p_bubbles, p_cancelable );
         
         bandwidth = p_bandwidth;
      }
      
   }
   
}

Por anikilatorbeta

42 de clabLevel



 

chrome
Citar            
MensajeEscrito el 20 Nov 2010 11:35 am
Estas clases creo que vienen en algún paquete de FMS, no recuerdo si automáticamente llamaba a las funciones el FMS en la conexión o había que hacer algo más, ¿tienes algún archivo del lado del servidor?

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 20 Nov 2010 02:07 pm
no ninguno estoy siguiendo el siguiente tutorial
http://www.adobe.com/livedocs/flashmediaserver/3.0/hpdocs/00000072.html#1068463
y ya tengo activada la opcion en aplication

Por anikilatorbeta

42 de clabLevel



 

chrome

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.