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

macromedia flash flashcom : Simultaneous recording & playing


wvxvw
12/26/2006 7:21:21 PM
Hi all.
I know my problem should be easy to solve, but I can't finde a glue. Please,
be patient for I'm totally new to the issue.
Here's the code:
broadcasting (publishing SWF)

[code]var my_cam:Camera = Camera.get();
var my_video:Video;
my_video.attachVideo(my_cam);
var client_nc = new NetConnection();
client_nc.virtualKey = "live";
client_nc.connect("rtmp:/record", "cam");
out_ns = new NetStream(client_nc);
out_ns.attachVideo(my_cam);
out_ns.publish("my_recorded_stream", "record");
client_nc.msgFromSrvr = function(msg) {
trace(msg);
for(i in msg){
trace(i+" "+msg[i]);
}
};
[/code]

and here's the SWF intendet to accept the video:

[code]var my_video:Video;
var client_nc = new NetConnection();
client_nc.connect("rtmp:/record", "user");
in_ns = new NetStream(client_nc);
in_ns.attachVideo(my_video);
in_ns.play("my_recorded_stream.flv");
client_nc.r_play = function(msg) {
trace(msg);
for(i in in_ns){
trace(i +" "+in_ns[i]);
}
for(i in _root.my_video){
trace(i+" # "+_root.my_video[i]);
}
};
[/code]
I can see server creating a new my_recorded_stream.flv, but the second SWF
recieves nothing.
I would greatly apprecate any help!
JayCharles
12/26/2006 11:07:58 PM
In the .swf that is receiving the stream, here's where you're going wrong:

in_ns.play("my_recorded_stream.flv");

when you play a stream, omit the .flv extension. When you want to play a live
stream (as you do in your case), you want to tell FMS to look only for the live
stream with that name. Try this:

my_ns.play("my_recorded_stream", -1, -1);

Docs for ns.play are here:


http://livedocs.macromedia.com/fms/2/docs/wwhelp/wwhimpl/common/html/wwhelp.htm?
href=00000588.html

wvxvw
1/15/2007 1:15:45 AM
AddThis Social Bookmark Button