Hi,
I want to build aa voice-chat application through red5.
The demo applications with the red5 subscriber.swf and subscriber.swf transmits the sound,
but with two seperate instance of Internet Explorer.
But I want to use only one instance of Internet Explorer. I tried the other demo applications available,
but things did not work out.
So I made the following code changes in the broadcaster's main.as file.

// ** AUTO-UI IMPORT STATEMENTS **
import org.red5.utils.Connector;
// ** END AUTO-UI IMPORT STATEMENTS **
import com.neoarchaic.ui.Tooltip;
import org.red5.net.Stream;
import org.red5.utils.Delegate;
import com.blitzagency.xray.util.XrayLoader;

class org.red5.samples.livestream.broadcaster.Main extends MovieClip {
// Constants:
    public static var CLASS_REF = org.red5.samples.livestream.broadcaster.Main;
    public static var LINKAGE_ID:String = "org.red5.samples.livestream.broadcaster.Main";
// Public Properties:
// Private Properties:
   

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//streamB and streamS are streams related to broadcaster and subscriber respectively//
    private var streamB:Stream;  
    private var streamS:Stream;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    private var cam:Camera;
    private var mic:Microphone;
// UI Elements:

// ** AUTO-UI ELEMENTS **
    private var connector:Connector;
    private var publish_video:Video;
// ** END AUTO-UI ELEMENTS **

// Initialization:
    private function Main() {XrayLoader.loadConnector("xray.swf");}
    private function onLoad():Void { configUI(); }

// Public Methods:
// Semi-Private Methods:
// Private Methods:
    private function configUI():Void
    {
        // setup the tooltip defaults
        Tooltip.options = {size:10, font:"_sans", corner:0};
       
        // setup cam
        cam = Camera.get();
        cam.setMode(480, 320, 15);
        cam.setQuality(0,80);
       
        // setup mic
        mic = Microphone.get();
       
        // get notified of connection changes
        connector.addEventListener("connectionChange", this);
       
        // set the uri
        Connector.red5URI = "rtmp://localhost/oflaDemo";
       
        // initialize the connector
        connector.configUI();   
    }
   
    private function status(evtObj:Object):Void
    {
        // deal with the status messages here
    }
   
    private function error(evtObj:Object):Void
    {
        // deal with the errors here
    }
   
    private function connectionChange(evtObj:Object):Void
    {
        if(evtObj.connected)
        {
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//the following are the code changes related to subscriber//
            // setup stream
            // XXX: odd hack needed for flashIDE.
            var conn = evtObj.connection;
            var x = new Stream(conn);
            streamS = x;
            streamS.play ("red5StreamDemo", -1);
            publish_video.attachVideo(streamS);



///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////          
//the following are the code changes related to broadcaster//
            // setup stream
            streamB = new Stream(evtObj.connection);
            // add stream status events listeners here
            streamB.addEventListener("status", Delegate.create(this, status));
            streamB.addEventListener("error", Delegate.create(this, error));
            // attach camera
            streamB.attachVideo (cam);
            // add audio
            streamB.attachAudio(mic);
            streamB.publish("red5StreamDemo", "live");
            // show it on screen
            publish_video.attachVideo(cam);
        }else
        {
            publish_video.attachVideo(null);
            publish_video.clear();
        }
    }

}


The resultant swf file transmits the sound but it is very noisy, cracking and meaningless.
Please help me, if anyone has a clue.
And thank in advance for the solution.
                                                                                     -Sabyasachi




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

Reply via email to