Hi,

Here my client side code :

stop();
// Create a connection
client_nc = new NetConnection();
// Handle status message
client_nc.onStatus = function(info) {
        trace("Level: "+info.level+"   Code: "+info.code);
};
// Connect to the application
client_nc.connect("rtmp://localhost/guest");
// Create a remote shared object
cam_video.attachVideo(Camera.get());
rec_so = SharedObject.getRemote("recordings", client_nc.uri, true);
// Update the list of recordings as new items are added
rec_so.onSync = function(list) {
        _root.Play_list.removeAll();
        // Fill list box with recordings
        for (var i in _root.rec_so.data) {
                _root.Play_list.addItem(i);
                trace(i);
                trace(rec_so.data);
        }
};
trace(client_nc.uri);
// Connect to the shared object
rec_so.connect(client_nc);
function doRecord() {
        if (ListItem.text == undefined || ListItem.text == "") {
                Status_msg.text = "Veuillez saisir un titre !";
        } else if (Record_btn.getLabel() == "Record") {
                Status_msg.text = "Enregistrement...";
                // Stop any currently playing stream
                if (Play_btn.getLabel() == "Stop") {
                        doPlay();
                }
                // Don't allow the user to play while recording
                Play_btn.setEnabled(false);
                // Create output stream
                out_ns = new NetStream(client_nc);
                // Start publishing the audio output as a recorded stream
                out_ns.attachAudio(Microphone.get());
                out_ns.attachVideo(Camera.get());
                // Publish the stream
                out_ns.publish(ListItem.text, "record");
                // This allows the entering of single-word list items
                _root.rec_so.data[ListItem.text] = ListItem.text;
                _root.rec_so.flush();
                // Change the button label
                Record_btn.setLabel("Stop");
        } else if (Record_btn.getLabel() == "Stop") {
                // Close output stream
                out_ns.close();
                // Now that you're finished recording, allow the user to play
                Play_btn.setEnabled(true);
                // Change the button label
                Record_btn.setLabel("Record");
                // Clear the ListItem.text
                ListItem.text = "";
                Status_msg.text = "...";
        }
}
// End doRecord method
// Do Play
function doPlay() {
        if (Play_btn.getLabel() == "Play") {
                Status_msg.text = "Playing...";
                Play_btn.setLabel("Stop");
                // Get the selected recording
                var playFileName = Play_list.getSelectedItem().label;
                // Create input stream and play the recording
                in_ns = new NetStream(_root.client_nc);
                my_video._visible = true;
                my_video.attachVideo(in_ns);
                in_ns.play(playFileName);
                in_ns.onStatus = function(info) {
                        // Handle errors and stream stopping
                        if (info.level == "error" || info.code == 
"NetStream.Play.Stop") {
                                Status_msg.text = "Fin du message...";
                                my_video._visible = false;
                                Play_btn.setLabel("Play");
                        }
                };
        } else if (Play_btn.getLabel() == "Stop") {
                Status_msg.text = "...";
                //Close the stream
                in_ns.onStatus = null;
                in_ns.close();
                Play_btn.setLabel("Play");
        }
}

On Flash Media Server, when i quit the application and re open it, my  
list is filled because i use a persistent sharedobject :
rec_so = SharedObject.getRemote("recordings", client_nc.uri, true);
On RED5, that don't work ! A persistence folder is created in my   
application but SO is not reuse.
For that, i'm searching a SIMPLE sample (fla+app) who use persistent  
sharedobject on RED5.
In fact, i don't know JAVA, and don't know what coding ServerSide.

Thanks a lot.

JP.

PS: i've posted on the Red5 forums yet, but never have answers.


_______________________________________________
Red5 mailing list
[email protected]
http://osflash.org/mailman/listinfo/red5_osflash.org

Reply via email to