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

    jepyssimo

    • Seasoned Programmer
    • ***
    • Posts: 118
      • View Profile
      • Email
    Re: Turn off cam of users
    « Reply #15 on: 10/18/05, 08:55 »
    Jorge, if I am userA, in my movie, with that button, I want to close cam of userB. My script doesn't works  ???

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re: Turn off cam of users
    « Reply #16 on: 10/18/05, 10:36 »
    Only User A can stop stream A
    User B can stop to SEE stream A. Is not the same as close stream, streams exists as far as the one publishing it don't stop publishing. So the only one that can stop Stream A is user A
    Each stream have ONE PUBLISHER and MANY CONSUMERS

    Jorge

    jepyssimo

    • Seasoned Programmer
    • ***
    • Posts: 118
      • View Profile
      • Email
    Re: Turn off cam of users
    « Reply #17 on: 10/19/05, 07:12 »
    Quote
    Only User A can stop stream A
    User B can stop to SEE stream A

    When I press button I (i'm user A  -  Admin) want to close cam of user B

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re: Turn off cam of users
    « Reply #18 on: 10/19/05, 08:38 »
    Then write a server side function to forward the call

    Client.prototype.closeCam = function(who){
      for (i = 0; i < application.clients.length; i++){
         application.clients.call("closeCam", who);
      }
    }

    Don't know whuy you're passing this._parent.name

    Jorge
    « Last Edit: 10/19/05, 09:17 by Jorge Solis »

    jepyssimo

    • Seasoned Programmer
    • ***
    • Posts: 118
      • View Profile
      • Email
    Re: Turn off cam of users
    « Reply #19 on: 10/19/05, 09:15 »
    George, I had put code in main.asc (I use your privatechat), but your application doesn't work more, aften that I restart.
    Error is this:

    **Error** Scene=Scene 1, layer=labels, frame=2:Line 67: Syntax error.
         Client.prototype.closeCam(who){

    Total ActionScript Errors: 1     Reported Errors: 1

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re: Turn off cam of users
    « Reply #20 on: 10/19/05, 09:18 »
    Forget to invclude function, fixed in my last post

    Jorge

    jepyssimo

    • Seasoned Programmer
    • ***
    • Posts: 118
      • View Profile
      • Email
    Re: Turn off cam of users
    « Reply #21 on: 10/19/05, 09:34 »
    Ok I include function:

    Client.prototype.closeCam = function(who) {
       for (i=0; i<application.clients.length; i++) {
          application.clients.call("closeCam", who);
       }
    };

    ...restart, application works, but button kickCam doesn't work :(

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re: Turn off cam of users
    « Reply #22 on: 10/19/05, 11:36 »
    Debug my friend, this is no magic.

    First question in debugging: is the client calling the function on server side?
    Second question: is the server executing the function.

    Try to debug before posting, "doesn't work" is not helpful

    Jorge

    jepyssimo

    • Seasoned Programmer
    • ***
    • Posts: 118
      • View Profile
      • Email
    Re: Turn off cam of users
    « Reply #23 on: 10/19/05, 14:31 »
    Sorry, but I' m not a guru in AS and flashcom.
    I do like you tell me.
    I think to have found the problem.
    For me, main.asc is ok and script on the butto works.
    Problem is in the 'switch and case' of function.
    I only try with:

    client_nc.closeCam = function() {
       _root.av1.stopPublish();
       trace("cam av1 off");
       break;
    };

    and it works good. Now, how I select cam to close?

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re: Turn off cam of users
    « Reply #24 on: 10/19/05, 14:46 »
    Quote
    Sorry, but I' m not a guru in AS and flashcom

    But you're in the track to be one, so your last question is much better. Let's see:

    application.clients.call("closeCam", who);

    Note the second argument, is the name of the cam that your original button pass, so incorporate to your function:

    client_nc.closeCam = function(cam) {
       _root[cam].stopPublish();
       trace("cam "+cam+" off");
    };

    Jorge

    jepyssimo

    • Seasoned Programmer
    • ***
    • Posts: 118
      • View Profile
      • Email
    Re: Turn off cam of users
    « Reply #25 on: 10/19/05, 14:56 »
    Ok, but now when I click on button, this does not send cam to close to function.
    Look at trace:

    Close Cam jep2
    cam  off

    Now, How I can communicate the cam to close to the function?

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re: Turn off cam of users
    « Reply #26 on: 10/20/05, 03:13 »
    This is an AVPresence method?

    stopPublish();

    Don't see in the docs. See instead:

    avPresence_mc.close()

    Jorge

    jepyssimo

    • Seasoned Programmer
    • ***
    • Posts: 118
      • View Profile
      • Email
    Re: Turn off cam of users
    « Reply #27 on: 10/20/05, 03:22 »
    Ok, but when I press a button to close a cam, script does not works, because function don't find 'cam' to close.

    kickCam.onPress = function() {
       var userKickCam = this._parent.username_txt.text;
       if (userKickCam != undefined) {
          trace("Close Cam "+userKickCam);
          _root.client_nc.call("closeCam", null, userKickCam);
       }
    };
    client_nc.closeCam = function(cam) {
       _root[cam].stopPublish();
       trace("cam "+cam+" off");
    };


    ...like you can see, in trace, the function don't find the cam to close:
    Close Cam jip2
    cam  off

    I try with:
    kickCam.onPress = function() {
            var cam = this._parent.name
    .............

    but does not works

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re: Turn off cam of users
    « Reply #28 on: 10/20/05, 03:44 »
    Is there a cam named jip2 on Stage?
    Then make an effort and find the path to it.

    Jorge

    jepyssimo

    • Seasoned Programmer
    • ***
    • Posts: 118
      • View Profile
      • Email
    Re: Turn off cam of users
    « Reply #29 on: 10/20/05, 03:54 »
    jep2 is name of user (userKickCam), no name of user's cam.

    Path of cams are:
    _root.av1
    _root.av2

    If I put directly name of cam, it works, but trace no again:
    client_nc.closeCam = function(av1) {
       _root.av1.stopPublish();
       trace("cam "+av1+" off");
    };