Forum


Notice to all users

We are migrating towards a new forum system located at community.teamspeak.com, as such this forum will become read-only on January 29, 2020

Results 1 to 4 of 4
  1. #1
    Join Date
    November 2015
    Posts
    2

    How to be notified when local client start recording ?

    I would like to start some code when I start recording the channel. So I wrote a plugin but I can't find any API to be notified when I start recording.

    The only way is to create an item menu in my plugin and then start recording through the item menu ?

  2. #2
    Join Date
    September 2012
    Posts
    6,079
    Not sure since I haven't tested this but I'd guess that you'll probably receive an onUpdateClientEvent when someone starts / stops recording. You could then check in that function whether the client is recording and whether it's your client.
    When sending PMs please make sure to include a reference link to the thread in question in the body of your message.

  3. #3
    Join Date
    November 2015
    Posts
    2
    This is my code, I try to know if my client is recording but it does not work. value and name are set to 0.

    Am I doing something wrong ?

    Code:
    void ts3plugin_onUpdateClientEvent(uint64 serverConnectionHandlerID, anyID clientID, anyID invokerID, const char* invokerName, const char* invokerUniqueIdentifier)
    {
        printf("On updateClientEvent %s %s %d %d test \n",invokerName,invokerUniqueIdentifier,clientID,invokerID);
        anyID localID;
        if(ts3Functions.getClientID(serverConnectionHandlerID,&localID)==ERROR_ok)
        {
            if(localID == clientID)
            {
                int value;
                char* name;
                if( ERROR_ok == (ts3Functions.getClientSelfVariableAsString(serverConnectionHandlerID,CLIENT_IS_RECORDING,&name)))
                {
                    printf("valueString %s\n",name);
                }
                if( ERROR_ok == ts3Functions.getClientSelfVariableAsInt(serverConnectionHandlerID,CLIENT_IS_RECORDING,&value))
                {
                    printf("value %d\n",value);
                    if(value == 1)
                    {
                            std::string str;
                                str += "dbus-send --type=method_call --session --dest=de.maartenbaert.ssr /  local.PageRecord.OnRecordStartPause'";
                                system(str.c_str());
                    }
                }
                ts3Functions.freeMemory(name);
            }
        }
    }

  4. #4
    Join Date
    September 2012
    Posts
    6,079
    As I expected it's working just fine:

    Quote Originally Posted by TeamSpeak Client
    <09:20:50> Started recording
    onUpdateClientEvent - on Server 1 for client 1 caused by client 0
    Recording Flag: 1
    <09:21:00> Stopped recording
    onUpdateClientEvent - on Server 1 for client 1 caused by client 0
    Recording Flag: 0
    Source:

    Code:
    void ts3plugin_onUpdateClientEvent(uint64 serverConnectionHandlerID, anyID clientID, anyID invokerID, const char* invokerName, const char* invokerUniqueIdentifier) {
    	using namespace std;
    	
    	anyID ownID = 0;
    	ts3.getClientID(serverConnectionHandlerID, &ownID);
    	if (ownID == 0 || ownID != clientID) return;
    	
    	string msg = "onUpdateClientEvent - on Server " + to_string(serverConnectionHandlerID) + " for client " + to_string(clientID) + " caused by client " + to_string(invokerID) + " " + string(invokerName);
    	ts3.printMessageToCurrentTab(msg.c_str());
    	
    	int val = -1;
    	ts3.getClientVariableAsInt(serverConnectionHandlerID, clientID, CLIENT_IS_RECORDING, &val);
    	msg = "Recording Flag: " + to_string(val);
    	ts3.printMessageToCurrentTab(msg.c_str());
    }
    PS: In your code you're trying to free a variable that hasn't necessarily been initialized. Only call freeMemory if the function that would allocate the memory succeeded.


    Edit: Upon closer inspection, I noticed you're using getClientSelfVariableAsInt. Using that I get the same behavior as you described, so it seems getClientSelfVariable has a bug. I created a ticket for this.
    Last edited by Chris; November 27th, 2015 at 11:47 AM.
    When sending PMs please make sure to include a reference link to the thread in question in the body of your message.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Permission for start and stop recording
    By k4kwq in forum Permission System
    Replies: 1
    Last Post: November 28th, 2012, 07:17 AM
  2. Notified when client enters different channel
    By MTFDarkEagle in forum Client Support
    Replies: 1
    Last Post: January 25th, 2012, 11:22 PM
  3. Ts3 start only local..
    By FedaN in forum Linux / FreeBSD
    Replies: 9
    Last Post: October 4th, 2010, 02:14 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •