Forum

Results 1 to 3 of 3
  1. #1
    Join Date
    December 2016
    Posts
    3

    Client restart in Unity on Android breaks audio (SDK 3.0.3.2)

    Hi,

    It appears that all audio output and capture fails for the Unity integration on Android, when attempting to restart a client.

    For instance, this simple modification to TS3_Client_Example effectively disables audio:

    Code:
    class TS3_Client_Example
    {
        ...
        void connect()
        {
            ...
            // Add these lines to the end to stop then restart the client:
            ts3_client.StopClient();
            ts3_client.StartClient(serverAddress, serverPort, serverPassword, nickName, ref defaultChannel, defaultChannelPassword);
        }
    This works on PC, but not on Android. It also appears the client is connecting to the server correctly (the server reports the disconnect and reconnect), but just the audio is broken (the server does not detect captured audio).
    Last edited by jdwilder; December 6th, 2016 at 12:42 AM. Reason: Corrected function name.

  2. #2
    Join Date
    December 2016
    Posts
    3
    As usually happens, I find a fix after posting...

    I took a look at the disassembled source for TeamSpeakUnity.jar included with the sample.

    It appears that TeamSpeakWrapper.InitClientLib constructs an instance of AudioThread just once, and stores it statically. That works, but since the AudioThread constructor indirectly calls startPLAY and startREC, subsequent calls to InitClientLib and ClientStart do not initiate playback and recording.

    Since I can't change the compiled .jar, I'm using a work-around in TeamSpeakClient.StartClient that explicitly restarts audio on secondary calls.

    For reference, the fix changes this:
    Code:
        ...
        if (!cbsInitialized)
        ...
        teamSpeakWrapper.CallStatic("InitClientLib");
        ...
    To this:
    Code:
        ...
        bool wasCbsInitialized = cbsInitialized;
        if (!cbsInitialized)
        ...
        teamSpeakWrapper.CallStatic("InitClientLib");
        if (wasCbsInitialized)
            teamSpeakWrapper.CallStatic("StartAudio");
        ...

  3. #3
    Join Date
    November 2017
    Posts
    2
    Thank you VERRY VERRY VERRY Much, this solved my Problem.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [Evaluation] Unity client ERROR_unable_to_bind_network_port
    By 8600862 in forum Client Support
    Replies: 2
    Last Post: June 17th, 2016, 11:31 AM
  2. Unity SDK client connection problems.
    By patxiku in forum Game Engines
    Replies: 2
    Last Post: May 18th, 2016, 12:27 PM
  3. Replies: 1
    Last Post: March 2nd, 2014, 12:42 AM
  4. Restart for audio sources?
    By Whinis in forum Linux
    Replies: 0
    Last Post: February 11th, 2010, 09:22 PM

Posting Permissions

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