Welcome, Guest
  • Author Topic: Turn off cam of users  (Read 19018 times)

    jepyssimo

    • Seasoned Programmer
    • ***
    • Posts: 118
      • View Profile
      • Email
    Turn off cam of users
    « on: 04/27/05, 06:18 »
    Hi All,
    in AVPresence, I had add a new button, btn_CamOff  (only Admin can see it). How can I do to turn off the cams of users?
    Thanks

    jepyssimo

    • Seasoned Programmer
    • ***
    • Posts: 118
      • View Profile
      • Email
    Re: Turn off cam of users
    « Reply #1 on: 04/27/05, 08:52 »
    I try with this script, but work only with my cam :( and I can't close the cam of another user.

    btn_CamOff.onRelease = function() {
       stopPublish();
    };

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re: Turn off cam of users
    « Reply #2 on: 04/27/05, 09:04 »
    From MM manual:

    Quote
    FCAVPresence.close
    Availability
    • Flash Player 6.
    • Flash Communication Server MX.
    Usage
    avPresence_mc.close()
    Parameters
    None.
    Returns
    Nothing.
    Description
    Method; cleans up after itself by freeing assets that this component uses on this client.

    Jorge

    jepyssimo

    • Seasoned Programmer
    • ***
    • Posts: 118
      • View Profile
      • Email
    Re: Turn off cam of users
    « Reply #3 on: 04/27/05, 09:15 »
    Ok but I need the code for my btn please. I think that my button call a function that close the cam. This function is in only in the fla?
    Thanks

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re: Turn off cam of users
    « Reply #4 on: 04/27/05, 09:50 »
     ???

    btn_CamOff.onRelease = function() {
       yourAVcomponent.close()
    };

    Where "yourAVcomponent" is the instance name of your AVPresence component

    Jorge

    jepyssimo

    • Seasoned Programmer
    • ***
    • Posts: 118
      • View Profile
      • Email
    Re: Turn off cam of users
    « Reply #5 on: 04/27/05, 14:48 »
    Ok, I have my buttons on yhe stage, in pricipal timeline, with this code:

    btn_CamOff1.onRelease = function() {
       av1.close();
    };
    btn_CamOff2.onRelease = function() {
       av2.close();
    };
    btn_CamOff3.onRelease = function() {
       av3.close();
    };
    btn_CamOff4.onRelease = function() {
       av4.close();
    };

    but dont work....

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re: Turn off cam of users
    « Reply #6 on: 04/28/05, 03:47 »
    Are your buttons targeting components? What you get when:

    btn_CamOff1.onRelease = function() {
       trace("Closing "+av1)
       av1.close();
    };

    Jorge

    jepyssimo

    • Seasoned Programmer
    • ***
    • Posts: 118
      • View Profile
      • Email
    Re: Turn off cam of users
    « Reply #7 on: 04/28/05, 04:16 »
    Jorge, trace work good... (Closing _level0.av1), but my cam is on again :(

    I connect cams with this code:

    av1.connect(client_nc);
    av1.setUsername(_global.username);

    It's possible another way?
    « Last Edit: 04/28/05, 04:56 by jepyssimo »

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re: Turn off cam of users
    « Reply #8 on: 04/28/05, 10:09 »
    Try:

    btn_CamOff1.onRelease = function() {
       trace("Closing "+av1)
       av1.stopPublish(this);
    };

    jepyssimo

    • Seasoned Programmer
    • ***
    • Posts: 118
      • View Profile
      • Email
    Re: Turn off cam of users
    « Reply #9 on: 04/28/05, 11:22 »
    Ok work very good but only when I close my cam.

    Example:
    I'm 'user1' and when I try to close the cam of 'user2', dont work.
    There is a solution?

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re: Turn off cam of users
    « Reply #10 on: 04/29/05, 04:59 »
    You want to close from client side (just you can't see the camera) or from server side (none of the users still see the camera)?

    Jorge

    jepyssimo

    • Seasoned Programmer
    • ***
    • Posts: 118
      • View Profile
      • Email
    Re: Turn off cam of users
    « Reply #11 on: 04/30/05, 07:56 »
    Jorge, from server side (none of the users still see the camera)... because many users abuse of cams. I dont want kick off their but I want close thei cams.

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re: Turn off cam of users
    « Reply #12 on: 05/03/05, 04:36 »
    Well, I don't know eaxctly how to get the stream from components framework. Using video objects, you just create a SharedObject with slots for each stream, and use his names for stop (from server side) If you don't know how manually create video for your users, check the the HelloVideo example (the first one) http://www.flash-communications.net/sourceCode/index.html and if you can, read the book, will clarify alot your work!

    Jorge

    jepyssimo

    • Seasoned Programmer
    • ***
    • Posts: 118
      • View Profile
      • Email
    Re: Turn off cam of users
    « Reply #13 on: 10/18/05, 07:41 »
    Hi Jorge, I'm near solution :)
    I want close from server side cams.
    I use AV componet and in that I have a new button on frame 4:
    kickCam.onPress = function() {
       var userKickCam = this._parent.username_txt.text;
       if (userKickCam != undefined) {
          trace("Close Cam "+userKickCam+"..."+this._parent.name);
          _root.client_nc.call("closeCam", null, userKickCam, this._parent.name);
       }
    };
    and on first frame of my movie:
    client_nc.closeCam = function(nomeav) {
       switch (nomeav) {
       case "av1" :
          _root.av1.stopPublish();
          break;
       case "av2" :
          _root.av2.stopPublish();
          break;
       case "av3" :
          _root.av3.stopPublish();
          break;
       case "av4" :
          _root.av4.stopPublish();
          break;
       }
    };

    well, how I send function to other users by main.asc?
    I had try with
    application.onConnectAccept = function(client, name){
        //Sets username in client side
       client.call("setUser", null, name);
       //Broadcast the event to all connected users
       this.users_so.send("newUser", name);
       this.users_so.send("closeCam");
    }

    but doesn't works (trace works)

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re: Turn off cam of users
    « Reply #14 on: 10/18/05, 08:26 »
    You don't need server side, nor attach the function to the NetConnection. Just stop publish on client side. This will stop others to see you if you're the broadcaster, or stop you to see others if you're receiving.

    Jorge