Welcome, Guest
  • Author Topic: Re:private chat with video  (Read 33831 times)

    gaby

    • Moderator
    • Seasoned Programmer
    • *****
    • Posts: 241
    • To code or not to code
      • View Profile
    Re:private chat with video
    « Reply #30 on: 07/29/04, 05:09 »
    Hi sachart...what do you mean by send vidéo only to selected user..? in my script window is broadcasted to all private windows opened...if you wish to broadcast it to some users only, like this i would say that you can add the "start/stop" video into the private window, so user can decide to send or not the video...or send another variable that will allow the user window to play or not the sent video...hope that help...

    Regards

    Gaby
    The courage to begin is the main step to achievement

    saschart

    • Jr. Programmer
    • **
    • Posts: 62
      • View Profile
      • Email
    Re:private chat with video
    « Reply #31 on: 08/02/04, 06:46 »
    Hy gaby,

    I solve the problem, I put stop/start video in private room and I put one additional parameter in
    srcStream.publish(room+_parent.username);  

    I have another problem: how can I take variables from users like a sex definited by url  http://localhost/base_chat.swf?username=John&sex=Male&age=33. I want to put sex or more variables in listbox for each user

    I tried to use call function but not work...
    « Last Edit: 08/03/04, 10:24 by saschart »

    saschart

    • Jr. Programmer
    • **
    • Posts: 62
      • View Profile
      • Email
    Re:private chat with video
    « Reply #32 on: 08/02/04, 09:37 »
    I try this code:

    function showDate (guest) {         
       client_nc.call("takeUserDate", null, guest);
       usersex //variables
                    userage //variables
    }

    client_nc.showUserDate = function(usersex, userage){
       usersex=sex;
       userage=age;   
    }

    And in server side:

    Client.prototype.takeUserDate= function(guest){
       application.userHandler[guest].call("showUserDate", null, usersex, userage)
    }



    Why don't work ?
    « Last Edit: 08/03/04, 09:28 by saschart »

    gaby

    • Moderator
    • Seasoned Programmer
    • *****
    • Posts: 241
    • To code or not to code
      • View Profile
    Re:private chat with video
    « Reply #33 on: 08/03/04, 09:38 »
    hi,

    to get variables sent in the url, load your flash movie like this in your html:

    <param name=movie value="fichiers/chat.swf?exp=<? echo $exp; ?>&amp;dest=<? echo $dest; ?>">
      <embed src="fichiers/chat.swf?exp=<? echo $exp; ?>&dest=<? echo $dest; ?>" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="740" height="500">
       </embed>

    send the variables you need throught the html, and so these variables can be called from inside the movie with: _root.variableName

    gaby
    The courage to begin is the main step to achievement

    saschart

    • Jr. Programmer
    • **
    • Posts: 62
      • View Profile
      • Email
    Re:private chat with video
    « Reply #34 on: 08/03/04, 10:41 »
    I know how put variables in swf file, but I don't know how can I take variables from each user and use it in list box.
    For example base_chat.swf?username=John&sex=Male&age=33 and base_chat.swf?username=Mike&sex=Male&age=30 I want add this data in list box like :
    Mike -sexMale-age30-
    John -sexMale-age33-

    I used call function for take all variables from inchat users - SSAS method - but not work:

    function showDate (guest) {         //user guest is user for listbox
      client_nc.call("takeUserDate", null, _global.username, guest);   
       client_nc.userDate = function(usersex, userage){
          usersex = usersex;
          userage = userage;
       }
                   usersex //variables for listbox
                   userage //variables for listbox
    }

    client_nc.showUserDate = function(sourceuser, usersex, userage){
       usersex=_global.sex;
       userage=_global.age;   
       client_nc.call("giveUserDate", null, sourceuser, usersex, userage);   
    }


    For server side:

    //Take data from user
    Client.prototype.takeUserDate= function(source, guest){
       application.userHandler[guest].call("showUserDate", null, source, usersex, userage)
    }

    //Give to user data
    Client.prototype.giveUserDate= function(source, usersex, userage){
       application.userHandler[source].call("userDate", null, usersex, userage)
    }



    saschart

    • Jr. Programmer
    • **
    • Posts: 62
      • View Profile
      • Email
    Re:private chat with video
    « Reply #35 on: 08/06/04, 03:47 »
    Nobody can help me ?

    Ivan

    • Server what's that
    • *
    • Posts: 6
      • View Profile
      • Email
    Re:private chat with video
    « Reply #36 on: 08/15/04, 22:52 »
    could anyone please send me the fla file for private video chat

    phoenix_pw@263.net

    Thanks in advance :)

    bob

    • Server what's that
    • *
    • Posts: 24
      • View Profile
      • Email
    Re:private chat with video
    « Reply #37 on: 08/16/04, 00:04 »
    supposedly, if you follow gaby's instructions you can create your own ;) but i'm good at being wrong.

    gaby

    • Moderator
    • Seasoned Programmer
    • *****
    • Posts: 241
    • To code or not to code
      • View Profile
    Re:private chat with video
    « Reply #38 on: 08/16/04, 04:13 »
    saschart, the easiest way would be to pass you variables in the username like this:


    username=John-Male-33

    it's a bit tricky but it'll work...

    ;-)
    The courage to begin is the main step to achievement

    saschart

    • Jr. Programmer
    • **
    • Posts: 62
      • View Profile
      • Email
    Re:private chat with video
    « Reply #39 on: 08/16/04, 05:22 »
    Thank you gaby

    Ivan

    • Server what's that
    • *
    • Posts: 6
      • View Profile
      • Email
    Re:private chat with video
    « Reply #40 on: 08/19/04, 01:53 »

    gaby :  this is my first post to what looks like a great site. Thanks for the code to add video to the private chat app. I wanted to take a look at your sample site but my french is weak. Is there a demo pass?  I seem to be having some issues with the video in the NewRoom. I am not sure how you intended it to function.  I have the video working in the main but no video is available in the new room.  Any ideas? I will take another try at getting on your site to see the funcitionality. thanks again

    Yes i still have this problem,i have the video working in the main but no video is available in the new room.How and where can i modify the codes ?Thanks very much!! :) :)

    gaby

    • Moderator
    • Seasoned Programmer
    • *****
    • Posts: 241
    • To code or not to code
      • View Profile
    Re:private chat with video
    « Reply #41 on: 08/19/04, 02:57 »
    Hi Ivan...

    check out the posts on that topic, the full code is indicated,step by step....

    Good luck
    The courage to begin is the main step to achievement

    liu21st

    • Server what's that
    • *
    • Posts: 1
      • View Profile
      • Email
    Re:private chat with video
    « Reply #42 on: 08/19/04, 04:21 »
    just have  a test about private chat with video,it's modify at flashcom commpent.
    you can look here :
    http://blog.liu21st.com/blog.php?job=art&articleid=a_20040707_072014

    Ivan

    • Server what's that
    • *
    • Posts: 6
      • View Profile
      • Email
    Re:private chat with video
    « Reply #43 on: 08/22/04, 20:59 »
    Yes,i have it worked!!!
    thx gaby,sorry for my incaution... :'(

    toddt

    • Server what's that
    • *
    • Posts: 26
      • View Profile
      • Email
    Re:private chat with video
    « Reply #44 on: 09/26/04, 20:01 »
    Hi,
    I have tried pasting in the code to add the video (the first part), but find I get syntax errors, this is my total script on the main frame,  as well as I've placed a video display and named it accordingly and added the component connect as shown below:

    errors are:
    **Error** Scene=Scene 1, layer=code, frame=10:Line 121: Syntax error.
          myCam = Camera.get()

    **Error** Scene=Scene 1, layer=code, frame=10:Line 122: Syntax error.
          myCam.setQuality(8192,80);

    Total ActionScript Errors: 2     Reported Errors: 2

    ---------------

    Am I adding it right, without the addition the code is fine, just when I add the video I get the syntax errors as above.

    stop()
    //////////////////////////////////////////////////////////////////////////////
    //Connect all components
    //////////////////////////////////////////////////////////////////////////////
    chat.connect(client_nc)
    peopleList.connect(client_nc)
    myColor.connect(client_nc)
    my_video2(client_nc)
    //Invisible until we check history
    chat._visible = false;
    //If we are the only user in this chat, clear the history
    checkHistory = new Object()
    checkHistory.onResult = function(cant){
       if(cant==1) chat.clearHistory()
       chat._visible = true
    }
    client_nc.call("checkClients", checkHistory)
    //////////////////////////////////////////////////////////////////////////////
    //Get and connect to the SO
    //////////////////////////////////////////////////////////////////////////////
    client_so = SharedObject.getRemote("users", client_nc.uri, false)
    client_so.connect(client_nc)
    //////////////////////////////////////////////////////////////////////////////
    //SO Handlers
    //////////////////////////////////////////////////////////////////////////////
    client_so.ref = this
    //A new user enters the room
    client_so.newUser = function(who){   
       this.ref.chat.history_txt.text+="***** "+who+" enters the room *****\n"
       this.ref.chat.history_txt.scroll+=1
    }
    //If the second parameter exists, user leaves application, if not, user only leaves private room
    client_so.onDisconnect = function(who, app){
       for(i in this.ref.inRoom) {
          if(this.ref.inRoom==who){
             this.ref.inRoom.splice(i, 1)
             this.ref["newRoom_"+who].gotoAndStop("Disconnect")
          }
       }
       if(app) {
          this.ref.chat.history_txt.text+="***** "+who+" leaves the room *****\n"
          this.ref.chat.history_txt.scroll+=1
       }
    }

    //////////////////////////////////////////////////////////////////////////////
    //Functions
    //This functions are called from inside this movie
    //////////////////////////////////////////////////////////////////////////////

    // Invite a user to join a private room
    function invite(guestUsername) {
       if(thinking || invitation) { //busy with a previous request
          trace(thinking+" or "+invitation._currentframe)
          status.text = "You have pending requests !!"
          return;
       }
       if (_global.username==guestUsername){ //click on myself
          attachMovie("thinking", "thinking", 101, {_x:45, _y:25, message:"You couldn't invite yourself !!"});
          thinking.gotoAndPlay("Answer")
          return;
       }
       for(i in inRoom) {
          if(inRoom==guestUsername){ //yet opened
             avisa = (!this["newRoom_"+guestUsername])?attachMovie("thinking", "thinking", 101, {_x:45, _y:25, message:"This user didn't close previous private chat"}) : attachMovie("thinking", "thinking", 101, {_x:45, _y:25, message:"You're in a private room with this user"});         
             thinking.gotoAndPlay("Answer")
             return;   
          }
       }
       // Open the 'thinking' movie
       this.attachMovie("thinking", "thinking", 101, {_x:45, _y:25});
       //Call the invite function in the serverside passing both usernames
       client_nc.call("invite", null, _global.username, guestUsername);   
    }
    // Answer a request passing both usernames and a boolean value(flag) to accept or reject
    function answer(source, me, flag) {
       //Call joinRoom SSAS method
       client_nc.call("joinRoom", null, source, me, flag);
    }

    ////////////////////////////////////////////////////////////////////
    // NetConnection Handlers
    ////////////////////////////////////////////////////////////////////
    client_nc.ref = this //reference to this timeline
    //Shows a messagge asking for opening a private chat room
    client_nc.showMessage = function(who) {
          if(thinking || invitation) //busy with another request
          this.ref.answer(who, _global.username, "busy")
          else attachMovie("invitation", "invitation", 100, {_x:45, _y:25, source:who});
    }
    //Answer to a request for a new private chat room
    client_nc.openRoom = function(flag, room, guest){
       if(flag == "busy"){
          thinking.message = "This user is busy with another request, try later"
          thinking.gotoAndPlay("Answer")
          return;
       }
       if(flag == false){ //reject
          thinking.gotoAndPlay("Reject")
       } else { //accept
          this.ref.inRoom.push(guest) //add to the list of opened private rooms
          //remove thinking message
          if (thinking) {
             //removes timeout
             clearInterval(this.ref.thinking.timeoutInterval)
             //removes clip
             removeMovieClip(this.ref.thinking)
          }
          //remove unclosed previous rooms with a user with this name
          if(eval("newRoom_"+guest)) removeMovieClip(this.ref["newRoom_"+guest])
          //unique levels for the new private chat room
          this.id++
          attachMovie("newRoom", "newRoom_"+guest, 110+this.id, {_x:45, _y:25, room:room, guest:guest});
          //Check if there's another window opened, and move a litle so they don't overlap totally
          if(this.ref.inRoom.length>1) this.ref["newRoom_"+guest]._y+=20
       }
    }

    function pubLive()
    {
      myCam = Camera.get()
      myCam.setQuality(8192,80);
      myCam.setMode("160", "120", "4");
      srcStream = new NetStream(client_nc);
      srcStream.publish(_root.exp, "live"); //this line tell your movie to publish a live stream named by the variable "exp" transmitted
      srcStream.attachVideo(myCam);
      my_video2.attachVideo(myCam);//this display your cam on a my_video2 object
     
      //myMic = Microphone.get();//you can uncomment this to add audio stream
      //srcStream.publish(_root.exp, "live");
      //srcStream.attachAudio(myMic);
     
    }
    function unpubLive()
    {
      //srcStream.attachAudio(null);
      //unloadMovie(_root.my_videodest);
      srcStream.close();
    }

    function disconnect() {

      // Stops publishing the stream.
      destStream.close();
     
      // Deletes the source stream connection.
      client_nc.close();
    }
    //PUBLICATION
    pubLive();

    stop();