Groups | Blog | Home
all groups > macromedia flash flashcom > november 2006 >

macromedia flash flashcom : NetConnection username/uri via variable


seraerie
11/6/2006 2:31:38 AM
Hi all.

I'm trying to pass the username and appinstance on the fly via query strings
to the flash applet I'm writing. However I've hit a rather weird snag:

[Q]nc = new NetConnection();
stop();
nc.onStatus = function(info) { trace(info.code); }
connectUri = "rmtp:/camtest/"+_root.room;
username = _root.staffName;
nc.connect(connectUri, username);
peopleList_mc.connect(nc);[/Q]

For some reason no matter what I do, I can't get the .connect method to accept
the username/connect uri using variables. I've checked and these variables are
indeed accessible via _root.room and _root.staffName in labels and so forth.

Any ideas? :confused;
mm_patrick
11/6/2006 3:10:41 PM
Have you checked out the samples on devnet? You should find everything you need
there.

Why are you using rConn instead of sConn to establish your netstream?
sConn = new NetConnection();
sConn.connect("rtmp://localhost/1", "test");
lStream = new NetStream([b]rConn[/b]);
I think this was just a typo.
When you publish, give it a name:
Instead of using: lStream.publish(localCam);
do lStream.publish(username); // where username is a string
Check out the flashmediaserver_cs_asd.pdf, page 102.

Also, currently you don't care whether or not the connection has been
established. Make sure you wait before you create your Netstream on top of the
connection. There is a great article on how to build such an application on
Adobe Devnet:
http://www.adobe.com/devnet/flashcom/articles/broadcast_receiver.html

To build a 2-way chat you would also have to put both users in the same
"room". The easiest way to achieve this is to create new application instances
for each new user pair, then connect to with
rtmp://host/application/new_instance _name and play the video of the other user.

There's some information in article
http://www.adobe.com/devnet/central/articles/vchat_04.html
This article is about how to build a 2-way video chat w/ central, but you can
possibly strip out that code.

Instead, I recommend having a look at the docs, i.e.
flashmediaserver_cs_asd.pdf to be found in your documentation directory.
seraerie
11/7/2006 12:00:00 AM
Hmmm now I've got a problem with video quality. I've set the broadcast video to
be the maximum the webcam supports 1.3mpx. My local preview embedded video
though is 160x320, with the remote display being at 320x240. On the receiving
end though the video is displayed at the right size (320x240) however it
appears to be a 160x120 stream stretched to the proper size...

Any idea why this is happening?

seraerie
11/7/2006 2:24:20 AM
AddThis Social Bookmark Button