ok got it. This line needs adding after nc = new NetConnection();:
 
nc.objectEncoding = flash.net.ObjectEncoding.AMF0;
 
Stefan
 
 


From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Stefan Richter
Sent: 03 April 2006 10:16
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Flex2 (beta2) app causes FMS2 to drop application

I have been playing around with two Flex applications.
One has been written by Brian
http://flash-communications.net/technotes/fms2/flex2FMS/index.html
<http://flash-communications.net/technotes/fms2/flex2FMS/index.html>  and
the other one is by Christophe Coenraets
http://coenraets.com/viewarticle.jsp?articleId=98
<http://coenraets.com/viewarticle.jsp?articleId=98>

Brian's example works fine for me but Christophe's example gave me problems.
I have sort of merged the two apps and have narrowed the problem down to one
line of code:

nsPublish = new NetStream(nc);

When I run this line I see the following in the FMS2 console:

Dropping application (flexvideo/_definst_) message. Clients not allowed to
broadcast message.

I can't figure out why this occurs, especially since Brian's app is very
similar. Here's my complete MXML code. All you need on the FMS side is an
app 'flexvideo' - no server side code is needed.

Note: some of the vars decalred here aren't actualy used. Can you shed any
light on this problem?

Stefan


<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*"
applicationComplete="init()">

<mx:Script>

<![CDATA[

private var nc:NetConnection;

private var camera:Camera;

private var microphone:Microphone;

private var nsPublish:NetStream;

private var nsPlay:NetStream;

private var localVid:Video;

private var videoFMS:Video;

private function init():void

{

nc = new NetConnection();

nc.connect("rtmp:/flexvideo");

nc.addEventListener(NetStatusEvent.NET_STATUS, netStatus);

nc.addEventListener(SecurityErrorEvent.SECURITY_ERROR, netSecurityError);

}

private function netStatus(event:NetStatusEvent):void {

// Write out information about connection events:

writeln("netStatus: " + event);

var info:Object = event.info;

for(var p:String in info) {

writeln(p + " : " + info[p]);

}

writeln("");

// Change the application state if we connect or disconnect.

switch(info.code)

{

case "NetConnection.Connect.Success":

// Close and recreate streams

if (nsPublish != null) nsPublish.close();

//if (nsPlay != null) nsPlay.close();

//nsPublish = new NetStream(nc);

//nsPlay = new NetStream(nc);

break;

case "NetConnection.Connect.Closed":

break;

}

}

/**

* Reports a security violation error after trying to connect.

*/

private function netSecurityError(event:SecurityErrorEvent):void {

writeln("netSecurityError: " + event);

}



private function startStream():void

{

camera = Camera.getCamera();

camera.setMode(160, 120, 6, true);

microphone = Microphone.getMicrophone();

localVid = new Video(160, 120);

localVid.attachCamera(camera);

var videoHolder:UIComponent = new UIComponent();

videoHolder.setActualSize(320, 120);

videoHolder.addChild(localVid);

outpanel.addChild(videoHolder);

localVid.x = 0;

localVid.y = 0;

// THIS LINE CAUSES THE ERROR

nsPublish = new NetStream(nc);

}

public function writeln(msg:String):void{

traceArea.text += msg + "\n";

traceArea.validateNow();

}

]]>

</mx:Script>

<mx:Panel title="Local WebCam" id="outpanel">

<mx:ControlBar>

<mx:Button label="Start Stream" click="startStream()"/>

</mx:ControlBar>

</mx:Panel>

<mx:TextArea width="486" height="217" id="traceArea"/>

</mx:Application>












--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to