2012-02-07 15 views
0

red5を正常にインストールしましたが、ビデオをストリーミングするためにred5に接続しようとすると接続が失敗します。 netstreaming(null)を使用すると動作しますが、red5を使用してもそれは動作しません。red5ストリーミングフレックスへの接続

私はストリームを接続するには、次のコードを使用し

<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" creationComplete="init();"> 
<fx:Script> 
    <![CDATA[ 
     import mx.utils.ObjectUtil; 

     private var nc:NetConnection; 
     private var ns:NetStream; 
     private var video:Video; 
     private var meta:Object; 
     private var videoURL:String = "Fleximagteaser.flv"; 

     private var nc1:NetConnection; 
     private var ns1:NetStream; 
     private var video1:Video; 
     private var meta1:Object; 

     private function init():void { 

      //video1 
      var nsClient:Object = {}; 
      nsClient.onMetaData = ns_onMetaData; 
      nsClient.onCuePoint = ns_onCuePoint; 

      nc = new NetConnection(); 
      nc.connect("rtmp://localhost/demo"); 

      ns = new NetStream(nc); 
      ns.play(videoURL); 
      ns.client = nsClient; 

      video = new Video(); 
      video.attachNetStream(ns); 
      uic.addChild(video); 
     } 

     private function ns_onMetaData(item:Object):void { 
      trace("meta"); 
      meta = item; 
      // Resize Video object to same size as meta data. 
      video.width = item.width; 
      video.height = item.height; 
      // Resize UIComponent to same size as Video object. 
      uic.width = video.width; 
      uic.height = video.height; 
      panel.title = "framerate: " + item.framerate; 
      panel.visible = true; 
      trace(ObjectUtil.toString(item)); 
     } 

     private function ns_onCuePoint(item:Object):void { 
      trace("cue"); 
     } 


    ]]> 
</fx:Script> 
<fx:Declarations> 
    <!-- Place non-visual elements (e.g., services, value objects) here --> 
</fx:Declarations> 
<mx:VBox> 
    <mx:Panel id="panel" visible="false"> 
    <mx:UIComponent id="uic" /> 
    <mx:ControlBar> 
     <mx:Button label="Play/Pause" click="ns.togglePause();" /> 
     <mx:Button label="Rewind" click="ns.seek(0); ns.pause();" /> 
    </mx:ControlBar> 
</mx:Panel> 

</mx:VBox> 
</s:Application> 

誰が助けることはできますか?

+0

あなたは、コンテンツデバッガのプラグインを使用していますか?エラーメッセージはありますか? – weltraumpirat

答えて

0
<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" creationComplete="init();"> 
<fx:Script> 
    <![CDATA[ 
     import flash.globalization.Collator; 

     import mx.utils.ObjectUtil; 

     private var nc:NetConnection; 
     private var ns:NetStream; 
     private var video:Video; 
     private var meta:Object; 
     private var videoURL:String = "Fleximagteaser.flv"; 

     private var nc1:NetConnection; 
     private var ns1:NetStream; 
     private var video1:Video; 
     private var meta1:Object; 

     private function init():void { 

      //video1 


      nc = new NetConnection(); 
      nc.connect("rtmp"); 
      nc.client = this; 
      nc.addEventListener(NetStatusEvent.NET_STATUS,onConnectionStatus); 
      nc.addEventListener(AsyncErrorEvent.ASYNC_ERROR,onErrorHandler); 
      nc.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecurityError); 



     } 

     private function onConnectionStatus(event:NetStatusEvent):void 
     { 
      var nsClient:Object = {}; 
      nsClient.onMetaData = ns_onMetaData; 
      nsClient.onCuePoint = ns_onCuePoint; 
      ns = new NetStream(nc); 
      ns.play("videourl"); 
      ns.client = nsClient; 

      video = new Video(); 
      video.attachNetStream(ns); 
      uic.addChild(video); 


     } 

     private function onErrorHandler(event:AsyncErrorEvent):void{} 
     private function onSecurityError(event:SecurityErrorEvent):void{} 



     private function ns_onMetaData(item:Object):void { 
      trace("meta"); 
      meta = item; 
      // Resize Video object to same size as meta data. 
      video.width = item.width; 
      video.height = item.height; 
      // Resize UIComponent to same size as Video object. 
      uic.width = video.width; 
      uic.height = video.height; 
      panel.title = "framerate: " + item.framerate; 
      panel.visible = true; 
      trace(ObjectUtil.toString(item)); 
     } 

     private function ns_onCuePoint(item:Object):void { 
      trace("cue"); 
     } 

     public function onBWDone():void 
     {} 



    ]]> 
</fx:Script> 
<fx:Declarations> 
    <!-- Place non-visual elements (e.g., services, value objects) here --> 
</fx:Declarations> 
<mx:VBox> 
    <mx:Panel id="panel" visible="false"> 
     <mx:UIComponent id="uic" /> 
     <mx:ControlBar> 
      <mx:Button label="Play/Pause" click="ns.togglePause();" /> 
      <mx:Button label="Rewind" click="ns.seek(0); ns.pause();" /> 
     </mx:ControlBar> 
    </mx:Panel> 

</mx:VBox>