Esempio n. 1
0
    protected void SDKErrorHandler(int error, string msg)
    {
        string description  = IRtcEngine.GetErrorDescription(error);
        string errorMessage = string.Format("onError callback {0} {1} {2}", error, msg, description);

        Debug_Log(errorMessage);
    }
Esempio n. 2
0
    protected void SDKWarningHandler(int warn, string msg)
    {
        string description    = IRtcEngine.GetErrorDescription(warn);
        string warningMessage = string.Format("onWarning callback {0} {1} {2}", warn, msg, description);

        Debug_Log(warningMessage);
    }
    /// <summary>
    ///   Load the Agora RTC engine with given AppID
    /// </summary>
    /// <param name="appId">Get the APP ID from Agora account</param>
    public void LoadEngine(string appId)
    {
        // init engine
        mRtcEngine = IRtcEngine.GetEngine(appId);

        mRtcEngine.OnError = (code, msg) =>
        {
            Debug.LogErrorFormat("RTC Error:{0}, msg:{1}", code, IRtcEngine.GetErrorDescription(code));
        };

        mRtcEngine.OnWarning = (code, msg) =>
        {
            Debug.LogWarningFormat("RTC Warning:{0}, msg:{1}", code, IRtcEngine.GetErrorDescription(code));
        };

        // mRtcEngine.SetLogFile(logFilepath);
        // enable log
        mRtcEngine.SetLogFilter(LOG_FILTER.DEBUG | LOG_FILTER.INFO | LOG_FILTER.WARNING | LOG_FILTER.ERROR | LOG_FILTER.CRITICAL);
    }
Esempio n. 4
0
 private void OnStreamPublished(string url, int errorCode)
 {
     /** Reports the result of calling the {@link agora_gaming_rtc.IRtcEngine.AddPublishStreamUrl AddPublishStreamUrl} method. (CDN live only.)
      *
      * @param url The RTMP URL address.
      * @param error Error code: Main errors include:
      * - ERR_OK(0): The publishing succeeds.
      * - ERR_FAILED(1): The publishing fails.
      * - ERR_INVALID_ARGUMENT(2): Invalid argument used. If, for example, you did not call {@link agora_gaming_rtc.IRtcEngine.SetLiveTranscoding SetLiveTranscoding} to configure LiveTranscoding before calling `AddPublishStreamUrl`, the SDK reports `ERR_INVALID_ARGUMENT(2)`.
      * - ERR_TIMEDOUT(10): The publishing timed out.
      * - ERR_ALREADY_IN_USE(19): The chosen URL address is already in use for CDN live streaming.
      * - ERR_RESOURCE_LIMITED(22): The backend system does not have enough resources for the CDN live streaming.
      * - ERR_ENCRYPTED_STREAM_NOT_ALLOWED_PUBLISH(130): You cannot publish an encrypted stream.
      * - ERR_PUBLISH_STREAM_CDN_ERROR(151)
      * - ERR_PUBLISH_STREAM_NUM_REACH_LIMIT(152)
      * - ERR_PUBLISH_STREAM_NOT_AUTHORIZED(153)
      * - ERR_PUBLISH_STREAM_INTERNAL_SERVER_ERROR(154)
      * - ERR_PUBLISH_STREAM_FORMAT_NOT_SUPPORTED(156)
      */
     Debug.Log("\n\n");
     Debug.Log("---------------OnStreamPublished called----------------");
     Debug.Log("OnStreamPublished url===" + url);
     Debug.Log("OnStreamPublished errorCode===" + errorCode + " = " + IRtcEngine.GetErrorDescription(errorCode));
 }
Esempio n. 5
0
    public void initAgoraEngine()
    {
        Debug.Log("init agora engine");

        mRtcEngine = IRtcEngine.GetEngine(appId);

        audioRawDataManager = AudioRawDataManager.GetInstance(mRtcEngine);
        audioRawDataManager.SetOnMixedAudioFrameCallback(OnMixedAudioFrameHandler);
        audioRawDataManager.SetOnPlaybackAudioFrameBeforeMixingCallback(OnPlaybackAudioFrameBeforeMixingHandler);
        audioRawDataManager.SetOnPlaybackAudioFrameCallback(OnPlaybackAudioFrameHandler);
        audioRawDataManager.SetOnRecordAudioFrameCallback(OnRecordAudioFrameHandler);

        // mRtcEngine.SetLogFilter(LOG_FILTER.INFO);

        // mRtcEngine.setLogFile("path_to_file_unity.log");

        //mRtcEngine.EnableDualStreamMode(true);
        mRtcEngine.SetClientRole(CLIENT_ROLE.BROADCASTER);

        //mRtcEngine.SetChannelProfile(CHANNEL_PROFILE.GAME_FREE_MODE);

        mDataStreamId = GameState.Instance.mRtcEngine.CreateDataStream(true, true);

        mRtcEngine.OnJoinChannelSuccess += (string channelName, uint uid, int elapsed) => {
            string joinSuccessMessage = string.Format(debugTag + "joinChannel callback uid: {0}, channel: {1}, version: {2}", uid, channelName, IRtcEngine.GetSdkVersion());
            //Debug.Log(joinSuccessMessage);

            Debug.Log("OnJoinChannelSuccess " + uid);

            UDID = uid;

            createCharacter(uid, true);

            GameState.Instance.PushState(EGameState.ChatRoomState);

            PopupManager.Instance.showLoadingPopUp(false);
        };

        //mRtcEngine.EnableVideo();
        //mRtcEngine.EnableVideoObserver();

        mRtcEngine.OnLeaveChannel += (RtcStats stats) => {
            string leaveChannelMessage = string.Format(debugTag + "onLeaveChannel callback duration {0}, tx: {1}, rx: {2}, tx kbps: {3}, rx kbps: {4}", stats.duration, stats.txBytes, stats.rxBytes, stats.txKBitRate, stats.rxKBitRate);
            //Debug.Log(leaveChannelMessage);



            //reloadEngine();
            audioRawDataManager.UnRegisteAudioRawDataObserver();
        };

        mRtcEngine.OnUserJoined += (uint uid, int elapsed) => {
            string userJoinedMessage = string.Format(debugTag + "onUserJoined callback uid {0} {1}", uid, elapsed);
            //Debug.Log(userJoinedMessage);

            Debug.Log("on user joined " + uid);

            //remote client
            //GameManager.Instance.createAvatar(uid, string.Empty);
            NetworkCharacter character = createCharacter(uid);

            if (lipSyncSolution == ELipSyncSolution.SalsaSolution)
            {
                int samplerate = 44100;

                clipTemp = AudioClip.Create("clipTemp", samplerate * 2, 1, samplerate, false);

                character.audioSource.clip = clipTemp;
                character.audioSource.loop = true;

                character.salsaComponent.audioSrc = character.audioSource;

                character.salsaComponent.SetAudioClip(character.audioSource.clip);



                character.audioSource.Play();



                //character.salsaComponent.Play();

                //character.audioSource.clip = clipTemp;


                //character.audioSource.Play();

                //character.salsaComponent.audioClip = clipTemp;
                character.salsaComponent.Play();
            }
        };

        mRtcEngine.OnUserOffline += (uint uid, USER_OFFLINE_REASON reason) => {
            string userOfflineMessage = string.Format(debugTag + "onUserOffline callback uid {0} {1}", uid, reason);
            //Debug.Log(userOfflineMessage);

            NetworkCharacter character = getCharacterFromID(uid);

            Destroy(character.gameObject);

            GameManager.Instance.UserLeaveChannel(uid);
        };

        mRtcEngine.OnVolumeIndication += (AudioVolumeInfo[] speakers, int speakerNumber, int totalVolume) => {
            if (speakerNumber == 0 || speakers == null)
            {
                //Debug.Log(string.Format(debugTag + "onVolumeIndication only local {0}", totalVolume));
            }

            for (int idx = 0; idx < speakerNumber; idx++)
            {
                string volumeIndicationMessage = string.Format(debugTag + "{0} onVolumeIndication {1} {2}", speakerNumber, speakers[idx].uid, speakers[idx].volume);
                //Debug.Log(volumeIndicationMessage);
            }
        };

        mRtcEngine.OnStreamMessageError += (uint userId, int streamId, int code, int missed, int cached) =>
        {
            Debug.Log("OnStreamMessageError " + code);
        };

        mRtcEngine.OnStreamMessage += (uint uid, int streamId, string data, int length) => {
            NetworkCharacter networkCharacter = getCharacterFromID(uid);

            Debug.Log("receive OnStreamMessage");

            networkCharacter.ReceiveLipsyncMessage(data);
        };

        mRtcEngine.OnUserMuted += (uint uid, bool muted) => {
            string userMutedMessage = string.Format(debugTag + "onUserMuted callback uid {0} {1}", uid, muted);
            //Debug.Log(userMutedMessage);
        };

        mRtcEngine.OnWarning += (int warn, string msg) => {
            string description    = IRtcEngine.GetErrorDescription(warn);
            string warningMessage = string.Format(debugTag + "onWarning callback {0} {1} {2}", warn, msg, description);
            //Debug.Log(warningMessage);
        };

        mRtcEngine.OnError += (int error, string msg) => {
            string description  = IRtcEngine.GetErrorDescription(error);
            string errorMessage = string.Format(debugTag + "onError callback {0} {1} {2}", error, msg, description);
            //Debug.Log(errorMessage);
        };

        mRtcEngine.OnRtcStats += (RtcStats stats) => {
            string rtcStatsMessage = string.Format(debugTag + "onRtcStats callback duration {0}, tx: {1}, rx: {2}, tx kbps: {3}, rx kbps: {4}, tx(a) kbps: {5}, rx(a) kbps: {6} users {7}",
                                                   stats.duration, stats.txBytes, stats.rxBytes, stats.txKBitRate, stats.rxKBitRate, stats.txAudioKBitRate, stats.rxAudioKBitRate, stats.users);
            //Debug.Log(rtcStatsMessage);

            int lengthOfMixingFile = mRtcEngine.GetAudioMixingDuration();
            int currentTs          = mRtcEngine.GetAudioMixingCurrentPosition();

            //string mixingMessage = string.Format(debugTag + "Mixing File Meta {0}, {1}", lengthOfMixingFile, currentTs);
            // Debug.Log(mixingMessage);
        };

        mRtcEngine.OnAudioRouteChanged += (AUDIO_ROUTE route) => {
            //string routeMessage = string.Format(debugTag + "onAudioRouteChanged {0}", route);
            //Debug.Log(routeMessage);
        };

        mRtcEngine.OnRequestToken += () => {
            string requestKeyMessage = string.Format(debugTag + "OnRequestToken");
            //Debug.Log(requestKeyMessage);
        };

        mRtcEngine.OnConnectionInterrupted += () => {
            string interruptedMessage = string.Format(debugTag + "OnConnectionInterrupted");
            //Debug.Log(interruptedMessage);
        };

        mRtcEngine.OnConnectionLost += () => {
            string lostMessage = string.Format(debugTag + "OnConnectionLost");
            //Debug.Log(lostMessage);
        };
    }
    void GotoStart()
    {
#if (UNITY_2018_3_OR_NEWER)
        if (Permission.HasUserAuthorizedPermission(Permission.Microphone))
        {
        }
        else
        {
            Permission.RequestUserPermission(Permission.Microphone);
        }
#endif


        mRtcEngine = IRtcEngine.GetEngine(AppID);

        mRtcEngine.OnJoinChannelSuccess += (string channelName, uint uid, int elapsed) =>
        {
            string joinSuccessMessage = string.Format("joinChannel callback uid: {0}, channel: {1}, version: {2}", uid, channelName, getSdkVersion());
            Debug.Log(joinSuccessMessage);
        };

        mRtcEngine.OnLeaveChannel += (RtcStats stats) =>
        {
            string leaveChannelMessage = string.Format("onLeaveChannel callback duration {0}, tx: {1}, rx: {2}, tx kbps: {3}, rx kbps: {4}", stats.duration, stats.txBytes, stats.rxBytes, stats.txKBitRate, stats.rxKBitRate);
            Debug.Log(leaveChannelMessage);

            // reset the mute button state
            //if (isMuted)
            //{
            //    MuteButtonTapped();
            //}
        };

        mRtcEngine.OnUserJoined += (uint uid, int elapsed) =>
        {
            string userJoinedMessage = string.Format("onUserJoined callback uid {0} {1}", uid, elapsed);
            Debug.Log(userJoinedMessage);
        };

        mRtcEngine.OnUserOffline += (uint uid, USER_OFFLINE_REASON reason) =>
        {
            string userOfflineMessage = string.Format("onUserOffline callback uid {0} {1}", uid, reason);
            Debug.Log(userOfflineMessage);
        };

        mRtcEngine.OnVolumeIndication += (AudioVolumeInfo[] speakers, int speakerNumber, int totalVolume) =>
        {
            //if (speakerNumber == 0 || speakers == null)
            //{
            //    Debug.Log(string.Format("onVolumeIndication only local {0}", totalVolume));
            //}

            for (int idx = 0; idx < speakerNumber; idx++)
            {
                string volumeIndicationMessage = string.Format("{0} onVolumeIndication {1} {2}", speakerNumber, speakers[idx].uid, speakers[idx].volume);
                Debug.Log(volumeIndicationMessage);
            }
        };

        mRtcEngine.OnUserMutedAudio += (uint uid, bool muted) =>
        {
            string userMutedMessage = string.Format("onUserMuted callback uid {0} {1}", uid, muted);
            Debug.Log(userMutedMessage);
        };

        mRtcEngine.OnWarning += (int warn, string msg) =>
        {
            string description    = IRtcEngine.GetErrorDescription(warn);
            string warningMessage = string.Format("onWarning callback {0} {1} {2}", warn, msg, description);
            Debug.Log(warningMessage);
        };

        mRtcEngine.OnError += (int error, string msg) =>
        {
            string description  = IRtcEngine.GetErrorDescription(error);
            string errorMessage = string.Format("onError callback {0} {1} {2}", error, msg, description);
            Debug.Log(errorMessage);
        };

        mRtcEngine.OnRtcStats += (RtcStats stats) =>
        {
            string rtcStatsMessage = string.Format("onRtcStats callback duration {0}, tx: {1}, rx: {2}, tx kbps: {3}, rx kbps: {4}, tx(a) kbps: {5}, rx(a) kbps: {6} users {7}",
                                                   stats.duration, stats.txBytes, stats.rxBytes, stats.txKBitRate, stats.rxKBitRate, stats.txAudioKBitRate, stats.rxAudioKBitRate, stats.userCount);

            int lengthOfMixingFile = mRtcEngine.GetAudioMixingDuration();
            int currentTs          = mRtcEngine.GetAudioMixingCurrentPosition();

            string mixingMessage = string.Format("Mixing File Meta {0}, {1}", lengthOfMixingFile, currentTs);
        };

        mRtcEngine.OnAudioRouteChanged += (AUDIO_ROUTE route) =>
        {
            string routeMessage = string.Format("onAudioRouteChanged {0}", route);
            Debug.Log(routeMessage);
        };

        mRtcEngine.OnRequestToken += () =>
        {
            string requestKeyMessage = string.Format("OnRequestToken");
            Debug.Log(requestKeyMessage);
        };

        mRtcEngine.OnConnectionInterrupted += () =>
        {
            string interruptedMessage = string.Format("OnConnectionInterrupted");
            Debug.Log(interruptedMessage);
        };

        mRtcEngine.OnConnectionLost += () =>
        {
            string lostMessage = string.Format("OnConnectionLost");
            Debug.Log(lostMessage);
        };

        mRtcEngine.SetLogFilter(LOG_FILTER.INFO);

        mRtcEngine.SetChannelProfile(CHANNEL_PROFILE.CHANNEL_PROFILE_COMMUNICATION);
    }
Esempio n. 7
0
    // Use this for initialization
    void Start()
    {
                    #if (UNITY_2018_3_OR_NEWER)
        if (Permission.HasUserAuthorizedPermission(Permission.Microphone))
        {
        }
        else
        {
            Permission.RequestUserPermission(Permission.Microphone);
        }
                        #endif

        joinChannel.onClick.AddListener(JoinChannel);
        leaveChannel.onClick.AddListener(LeaveChannel);

        mRtcEngine = IRtcEngine.GetEngine(appId);
        versionText.GetComponent <Text> ().text = "Version : " + IRtcEngine.GetSdkVersion();

        mRtcEngine.OnJoinChannelSuccess += (string channelName, uint uid, int elapsed) => {
            string joinSuccessMessage = string.Format("joinChannel callback uid: {0}, channel: {1}, version: {2}", uid, channelName, IRtcEngine.GetSdkVersion());
            Debug.Log(joinSuccessMessage);
            mShownMessage.GetComponent <Text> ().text = (joinSuccessMessage);
        };

        mRtcEngine.OnLeaveChannel += (RtcStats stats) => {
            string leaveChannelMessage = string.Format("onLeaveChannel callback duration {0}, tx: {1}, rx: {2}, tx kbps: {3}, rx kbps: {4}", stats.duration, stats.txBytes, stats.rxBytes, stats.txKBitRate, stats.rxKBitRate);
            Debug.Log(leaveChannelMessage);
            mShownMessage.GetComponent <Text> ().text = (leaveChannelMessage);
        };

        mRtcEngine.OnUserJoined += (uint uid, int elapsed) => {
            string userJoinedMessage = string.Format("onUserJoined callback uid {0} {1}", uid, elapsed);
            Debug.Log(userJoinedMessage);
        };

        mRtcEngine.OnUserOffline += (uint uid, USER_OFFLINE_REASON reason) => {
            string userOfflineMessage = string.Format("onUserOffline callback uid {0} {1}", uid, reason);
            Debug.Log(userOfflineMessage);
        };

        mRtcEngine.OnVolumeIndication += (AudioVolumeInfo[] speakers, int speakerNumber, int totalVolume) => {
            if (speakerNumber == 0 || speakers == null)
            {
                Debug.Log(string.Format("onVolumeIndication only local {0}", totalVolume));
            }

            for (int idx = 0; idx < speakerNumber; idx++)
            {
                string volumeIndicationMessage = string.Format("{0} onVolumeIndication {1} {2}", speakerNumber, speakers[idx].uid, speakers[idx].volume);
                Debug.Log(volumeIndicationMessage);
            }
        };

        mRtcEngine.OnUserMuted += (uint uid, bool muted) => {
            string userMutedMessage = string.Format("onUserMuted callback uid {0} {1}", uid, muted);
            Debug.Log(userMutedMessage);
        };

        mRtcEngine.OnWarning += (int warn, string msg) => {
            string description    = IRtcEngine.GetErrorDescription(warn);
            string warningMessage = string.Format("onWarning callback {0} {1} {2}", warn, msg, description);
            Debug.Log(warningMessage);
        };

        mRtcEngine.OnError += (int error, string msg) => {
            string description  = IRtcEngine.GetErrorDescription(error);
            string errorMessage = string.Format("onError callback {0} {1} {2}", error, msg, description);
            Debug.Log(errorMessage);
        };

        mRtcEngine.OnRtcStats += (RtcStats stats) => {
            string rtcStatsMessage = string.Format("onRtcStats callback duration {0}, tx: {1}, rx: {2}, tx kbps: {3}, rx kbps: {4}, tx(a) kbps: {5}, rx(a) kbps: {6} users {7}",
                                                   stats.duration, stats.txBytes, stats.rxBytes, stats.txKBitRate, stats.rxKBitRate, stats.txAudioKBitRate, stats.rxAudioKBitRate, stats.users);
            Debug.Log(rtcStatsMessage);

            int lengthOfMixingFile = mRtcEngine.GetAudioMixingDuration();
            int currentTs          = mRtcEngine.GetAudioMixingCurrentPosition();

            string mixingMessage = string.Format("Mixing File Meta {0}, {1}", lengthOfMixingFile, currentTs);
            Debug.Log(mixingMessage);
        };

        mRtcEngine.OnAudioRouteChanged += (AUDIO_ROUTE route) => {
            string routeMessage = string.Format("onAudioRouteChanged {0}", route);
            Debug.Log(routeMessage);
        };

        mRtcEngine.OnRequestToken += () => {
            string requestKeyMessage = string.Format("OnRequestToken");
            Debug.Log(requestKeyMessage);
        };

        mRtcEngine.OnConnectionInterrupted += () => {
            string interruptedMessage = string.Format("OnConnectionInterrupted");
            Debug.Log(interruptedMessage);
        };

        mRtcEngine.OnConnectionLost += () => {
            string lostMessage = string.Format("OnConnectionLost");
            Debug.Log(lostMessage);
        };

        mRtcEngine.SetLogFilter(LOG_FILTER.INFO);

        // mRtcEngine.setLogFile("path_to_file_unity.log");

        mRtcEngine.SetChannelProfile(CHANNEL_PROFILE.GAME_FREE_MODE);

        // mRtcEngine.SetChannelProfile (CHANNEL_PROFILE.GAME_COMMAND_MODE);
        // mRtcEngine.SetClientRole (CLIENT_ROLE.BROADCASTER);
    }
 void OnSDKErrorHandler(int error, string msg)
 {
     logger.UpdateLog(string.Format("OnSDKError error: {0}, msg: {1}", error, IRtcEngine.GetErrorDescription(error)));
 }
 void OnSDKWarningHandler(int warn, string msg)
 {
     logger.UpdateLog(string.Format("OnSDKWarning warn: {0}, msg: {1}", warn, IRtcEngine.GetErrorDescription(warn)));
 }
    // Use this for initialization
    void Start()
    {
        if (!mInitialized)
        {
            mInitialized = true;
            isRecord     = false;

            mRtcEngine = IRtcEngine.GetEngine(appId);

            mRtcEngine.OnJoinChannelSuccess += (string channelName, uint uid, int elapsed) => {
                string joinSuccessMessage = string.Format("joinChannel callback uid: {0}, channel: {1}, version: {2}", uid, channelName, IRtcEngine.GetSdkVersion());
                Debug.Log(joinSuccessMessage);

                mShownMessage.GetComponent <Text> ().text = (joinSuccessMessage);
            };

            mRtcEngine.OnLeaveChannel += (RtcStats stats) => {
                string leaveChannelMessage = string.Format("onLeaveChannel callback duration {0}, tx: {1}, rx: {2}, tx kbps: {3}, rx kbps: {4}", stats.duration, stats.txBytes, stats.rxBytes, stats.txKBitRate, stats.rxKBitRate);
                Debug.Log(leaveChannelMessage);
                mShownMessage.GetComponent <Text> ().text = (leaveChannelMessage);
            };

            mRtcEngine.OnUserJoined += (uint uid, int elapsed) => {
                string userJoinedMessage = string.Format("onUserJoined callback uid {0} {1}", uid, elapsed);
                //int a = mRtcEngine.SetRemoteVoicePosition (uid, -1 ,50.0);
                //Debug.Log ("OnUserJoined  setRemoteVoicePosition a = "+ a);
                AudioEffectManagerImpl audio = new AudioEffectManagerImpl(mRtcEngine);
                int a = audio.SetRemoteVoicePosition(uid, -1, 0);
                Debug.Log("OnUserJoined  setRemoteVoicePosition = " + a);
                Debug.Log(userJoinedMessage);
            };

            mRtcEngine.OnUserOffline += (uint uid, USER_OFFLINE_REASON reason) => {
                string userOfflineMessage = string.Format("onUserOffline callback uid {0} {1}", uid, reason);
                Debug.Log(userOfflineMessage);
            };

            mRtcEngine.OnVolumeIndication += (AudioVolumeInfo[] speakers, int speakerNumber, int totalVolume) => {
                if (speakerNumber == 0 || speakers == null)
                {
                    Debug.Log(string.Format("onVolumeIndication only local {0}", totalVolume));
                }

                for (int idx = 0; idx < speakerNumber; idx++)
                {
                    string volumeIndicationMessage = string.Format("{0} onVolumeIndication {1} {2}", speakerNumber, speakers [idx].uid, speakers [idx].volume);
                    Debug.Log(volumeIndicationMessage);
                }
            };

            mRtcEngine.OnUserMuted += (uint uid, bool muted) => {
                string userMutedMessage = string.Format("onUserMuted callback uid {0} {1}", uid, muted);
                Debug.Log(userMutedMessage);
            };

            mRtcEngine.OnWarning += (int warn, string msg) => {
                string description    = IRtcEngine.GetErrorDescription(warn);
                string warningMessage = string.Format("onWarning callback {0} {1} {2}", warn, msg, description);
                Debug.Log(warningMessage);
            };

            mRtcEngine.OnError += (int error, string msg) => {
                string description  = IRtcEngine.GetErrorDescription(error);
                string errorMessage = string.Format("onError callback {0} {1} {2}", error, msg, description);
                Debug.Log(errorMessage);
            };

            mRtcEngine.OnRtcStats += (RtcStats stats) => {
                string rtcStatsMessage = string.Format("onRtcStats callback duration {0}, tx: {1}, rx: {2}, tx kbps: {3}, rx kbps: {4}, tx(a) kbps: {5}, rx(a) kbps: {6} users {7}",
                                                       stats.duration, stats.txBytes, stats.rxBytes, stats.txKBitRate, stats.rxKBitRate, stats.txAudioKBitRate, stats.rxAudioKBitRate, stats.users);
                Debug.Log(rtcStatsMessage);

                int lengthOfMixingFile = mRtcEngine.GetAudioMixingDuration();
                int currentTs          = mRtcEngine.GetAudioMixingCurrentPosition();

                string mixingMessage = string.Format("Mixing File Meta {0}, {1}", lengthOfMixingFile, currentTs);
                Debug.Log(mixingMessage);
            };

            mRtcEngine.OnAudioRouteChanged += (AUDIO_ROUTE route) => {
                string routeMessage = string.Format("onAudioRouteChanged {0}", route);
                Debug.Log(routeMessage);
            };

            mRtcEngine.OnRequestChannelKey += () => {
                string requestKeyMessage = string.Format("OnRequestChannelKey");
                Debug.Log(requestKeyMessage);
            };

            mRtcEngine.OnConnectionInterrupted += () => {
                string interruptedMessage = string.Format("OnConnectionInterrupted");
                Debug.Log(interruptedMessage);
            };

            mRtcEngine.OnConnectionLost += () => {
                string lostMessage = string.Format("OnConnectionLost");
                Debug.Log(lostMessage);
            };

            mRtcEngine.SetLogFilter(LOG_FILTER.INFO);

            // mRtcEngine.setLogFile("path_to_file_unity.log");

            mRtcEngine.SetChannelProfile(CHANNEL_PROFILE.GAME_FREE_MODE);
            mRtcEngine.EnableAudio();

            // mRtcEngine.SetChannelProfile (CHANNEL_PROFILE.GAME_COMMAND_MODE);
            // mRtcEngine.SetClientRole (CLIENT_ROLE.BROADCASTER);
        }
    }