2012-05-17 4 views
0

FMS를 사용하여 웹캠에서 내 비디오를 스트리밍하려고합니다. 여기에 내가 작성하려고하는 코드가 작성되었지만이 오류가 발생합니다. 제발 올바른 해결책을 안내해주세요. 내가 얻을 수있는 모든 도움에 정말로 감사드립니다.FMS & Flex를 사용하여 웹캠에서 라이브 스트림 비디오

오류 : 오류 # 2044 : 처리되지 않은 AsyncErrorEvent :. text = 오류 # 2095 : flash.net.NetConnection이 onBWDone 콜백을 호출 할 수 없습니다. error = ReferenceError : 오류 # 1069 : onBWDone 속성이 vv에없고 기본값이 없습니다. 절에서 /button2_clickHandler() VV에서 [] /___ vv_Button2_click()]

<?xml version="1.0" encoding="utf-8"?> 
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
       xmlns:s="library://ns.adobe.com/flex/spark" 
       xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"> 
    <fx:Script> 
     <![CDATA[ 
      import mx.controls.Alert; 
      import mx.events.FlexEvent; 



      var camera:Camera = Camera.getCamera(); 
      var localCam:Video = new Video(420,313); 
      protected function video_d_creationCompleteHandler(event:FlexEvent):void 
      { 
       // TODO Auto-generated method stub 

       if (camera) { 
        //var localCam:Video = new Video(280,150); 
        localCam.attachCamera(camera); 
        localCam.smoothing = true; 
        //localCam. 
        video_d.addChild(localCam); 
       } else { 
        Alert.show("You don't seem to have a camera."); 
       } 
      } 


      protected function button2_clickHandler(event:MouseEvent):void 
      { 
       // TODO Auto-generated method stub 
       lsfmspanel.visible = true; 

       var nc:NetConnection = new NetConnection(); 
       nc.client = this; 
       nc.connect("rtmp://localhost/live"); 
       nc.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler); 

       function netStatusHandler(event:NetStatusEvent):void { 
        switch (event.info.code) { 
         case "NetConnection.Connect.Success": 
          var ns:NetStream = new NetStream(nc,NetStream.CONNECT_TO_FMS); 
          ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler); 
          ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, onBWDone); 
          ns.attachCamera(camera); 
          ns.publish("livestream", "live"); 

          break; 
         case "NetStream.Play.StreamNotFound": 
          trace("Unable to locate video: "); 
          break; 
        } 
       } 

       function asyncErrorHandler(event:AsyncErrorEvent):void { Alert.show("E." + event.text); } 
       function onBWDone(event:AsyncErrorEvent):void{ 
        trace("onBWDone"); 
       } 

      } 

     ]]> 
    </fx:Script> 
    <fx:Declarations> 
     <!-- Place non-visual elements (e.g., services, value objects) here --> 
    </fx:Declarations> 
    <s:Panel x="5" y="9" width="448" height="365" title="Live Stream"> 
     <s:VideoDisplay id="video_d" x="10" y="9" width="426" height="313" 
         creationComplete="video_d_creationCompleteHandler(event)"/> 
    </s:Panel> 
    <s:Panel x="462" y="9" width="448" height="365" title="Live Streaming From FMS" visible="false" id="lsfmspanel"> 
     <s:VideoDisplay id="livestream" x="10" y="9" width="426" height="313" source="rtmp://localhost/live" autoPlay="true"/> 
    </s:Panel> 
    <s:Button x="105" y="382" label="Start Streaming" click="button2_clickHandler(event)"/> 

</s:Application> 

답변

0

FMS의 비디오 스트림으로 플래시 미디어 인코더를 사용하지 않는 이유. Flash Media Encoder 응용 프로그램 또는 콘솔 명령을 사용할 수 있습니다.

+0

Horonchick. Flash Encoder를 사용하여 FMS를 살펴보고 작동 시키려고 노력하지만 호기심을 불러 일으킬 것입니다 ....해야합니까? 내가 사용하려고하는 메소드가 작동하지 않거나 권장되지 않는다는 것을 의미합니까? 감사합니다. –

+0

죄송합니다.이 방법에 익숙하지 않습니다. – Horonchik

+0

도움 주셔서 감사합니다. FME를 위해 나를 가리킬 수있는 링크는 무엇입니까? –

관련 문제