Skip to main content
December 26, 2006
Question

Simultaneous recording & playing

  • December 26, 2006
  • 2 replies
  • 289 views
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)

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 );
}
};


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

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);
}
for(i in _root.my_video){
trace(i+" # "+_root.my_video );
}
};

I can see server creating a new my_recorded_stream.flv, but the second SWF recieves nothing.
I would greatly apprecate any help!
    This topic has been closed for replies.

    2 replies

    January 15, 2007
    thank you, this solved the problem.
    December 26, 2006
    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