Skip to main content
niteshkumar
Inspiring
August 16, 2010
Question

increasing bandwidth while publishing live video

  • August 16, 2010
  • 1 reply
  • 720 views

Hi all,

  

     I have made a sample application for publishing video through FMS using as3.

     In that I had used the same code as given in the sample provided by the adobe,

     m_nc = new NetConnection("rtmpt://localhost:1935/Test");

     private function onNetStatus(event:NetStatusEvent):void
  {

     switch (event.info.code)
   {
    case "NetConnection.Connect.Success" :
     m_ns = new NetStream(m_nc);    
     m_nsPlayer = new NetStream(m_nc);
     m_nc.call("checkBandwidth", null);
       var camName:String = setCamera();
      if(camName == "null")
      {
         trace("Sorry! No Camera found");
         break;
       }
            if(camName == "NoWebCam")
            {
                 if(ExternalInterface.available)
                 {
                  ExternalInterface.call("CameraNotFound");
                 }
                 break;
             }
           var micIndex:int = setMicrophone();
           if(micIndex == -1)
           {
            trace("Sorry! No Mic found");
            break;
           }   
           publishCamera(camName,micIndex);
           displayPublishingVideo();
          }       
          break;

     }

}

private function publishCamera(camName:String,micIndex:int):void
  {
   m_cam=Camera.getCamera(camName);
   switch(m_resolution)
   {
    case "160x120" : m_cam.setMode(160,120,15);
     break;
    case "320x240" : m_cam.setMode(320,240,15);
     break;
    case "640x480" : m_cam.setMode(640,480,15);
     break;
    default      : m_cam.setMode(320,240,15);
     break;
   }
   m_cam.setQuality(0,85);
   if(micIndex != -1)
   {
    m_mic=Microphone.getMicrophone();
    m_mic.codec = SoundCodec.SPEEX;
    m_mic.setUseEchoSuppression(true);   
    m_mic.setLoopBack(false);
    m_mic.setSilenceLevel(20);
    m_ns.attachAudio(m_mic);   
   }  
   m_ns.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
   m_ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, onAsyncError);
   m_ns.attachCamera(m_cam);
   m_ns.publish(m_publishName, "live");
   stage.addEventListener(MouseEvent.CLICK, onStageClick);
  }

The above was the sample code just for publishing the video.

The similar code for viewing the published video was written

private function displayPlaybackVideo(publishName:String,muteSound:String):void
  {

     m_nsPlayer.bufferTime = 0.6;
   m_nsPlayer.addEventListener(NetStatusEvent.NET_STATUS,onstatus);
   m_vidPlayer.height = 480;
   m_vidPlayer.attachNetStream(m_nsPlayer);
   addChild(m_vidPlayer);
   m_isVideoChildAdded = true;

}

now after writing code I launched the application and started analyising the server console.

The server console shows the regular increament in bandwidth which hampers my video publish after 8-10 minutes resulting in stuck of video.

So, please help me in resolving the problem.

Thanx in advance.

    This topic has been closed for replies.

    1 reply

    Participating Frequently
    August 17, 2010

    What do you mean by stuck in video, do you mean your publish stops?

    niteshkumar
    Inspiring
    September 7, 2010

    hi.

       yes, publish of video stops as well as connection also gets loss, due to increase in http ISA limit.

    Please help.

    Thanks