Search code examples
flashactionscriptstreamwebcamadobe-cirrus

RTFMP - Remote stream not showing


I'm trying to create a 2-way videochat. Your own webcam shows perfectly fine, but the other doesn't. I used this page as an example: http://www.adobe.com/devnet/flashmediaserver/articles/p2p_apps_cirrus_lccs.html

Following the steps on the page doesn't seem to work for me. I exchange the peer IDs via PHP. I make my Flash visit a page, which stores the peer ID in the database using a POST request. To fetch the peer ID of the partner, I use PHP sessions, which store both your ID, and that of your partner. I can then use these variables to visit another PHP page, which echoes the partner's peer ID. Both are the same as in the database, so there's nothing wrong with that.

The NetConnection:

Connection = new NetConnection();
Connection.addEventListener(NetStatusEvent.NET_STATUS, CheckConnect);
Connection.connect(RTFMP + DevKey);

This is how I set up your own webcam plus its NetStream:

StreamOut = new NetStream(Connection, NetStream.DIRECT_CONNECTIONS); 
var SelfCam:DynamicStreamingVideoSource = new DynamicStreamingVideoSource();
var VideoItems:Vector.<DynamicStreamingVideoItem>;
VideoItems = new Vector.<DynamicStreamingVideoItem>();
VideoItems[0] = new DynamicStreamingVideoItem();

SelfCam.host = "";
SelfCam.streamType = StreamType.LIVE;
SelfCam.streamItems = VideoItems;

Self.source = SelfCam;

var Cam:Camera = Camera.getCamera();
var Mic:Microphone = Microphone.getMicrophone();
Cam.setMode(380, 255, 15);
Cam.setQuality(0, 80);
Self.videoObject.attachCamera(Cam);

StreamOut.attachAudio(Mic);
StreamOut.attachCamera(Cam);
StreamOut.publish("vids");

And this is how I receive the published stream "vids":

StreamIn = new NetStream(Connection, OtherID);
StreamIn.play("vids");
StreamIn.client = this;
Other.videoObject.attachNetStream(StreamIn);

The Other and Self objects are of type <s:VideoDisplay>.

I'm sure it must be something pretty damn simple, but I can't seem to lay my finger on it.


Solution

  • Never mind, I had to use mx:VideoDisplay rather than s:VideoDisplay.