private void OnJoinChannelSuccessHandler(string channelName, uint uid, int elapsed) { _logger.UpdateLog(string.Format("sdk version: ${0}", IRtcEngine.GetSdkVersion())); _logger.UpdateLog(string.Format("onJoinChannelSuccess channelName: {0}, uid: {1}, elapsed: {2}", channelName, uid, elapsed)); makeVideoView(0); }
void OnJoinChannelSuccessHandler(string channelName, uint uid, int elapsed) { logger.UpdateLog(string.Format("sdk version: ${0}", IRtcEngine.GetSdkVersion())); logger.UpdateLog(string.Format("onJoinChannelSuccess channelName: {0}, uid: {1}, elapsed: {2}", channelName, uid, elapsed)); logger.UpdateLog(string.Format("New Token: {0}", HelloVideoTokenAgora.channelToken)); // HelperClass.FetchToken(tokenBase, channelName, 0, this.RenewOrJoinToken); makeVideoView(0); }
void OnJoinChannelSuccessHandler(string channelName, uint uid, int elapsed) { logger.UpdateLog(string.Format("sdk version: ${0}", IRtcEngine.GetSdkVersion())); logger.UpdateLog(string.Format("onJoinChannelSuccess channelName: {0}, uid: {1}, elapsed: {2}", channelName, uid, elapsed)); // makeVideoView(0); _audioRawDataManager.SetOnPlaybackAudioFrameBeforeMixingCallback(OnPlaybackAudioFrameBeforeMixingHandler); }
protected void JoinChannelSuccessHandler(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); AgoraPlayerController.instance.OnChannelJoins(uid); }
public string getSdkVersion() { string ver = IRtcEngine.GetSdkVersion(); if (ver == "2.9.1.45") { ver = "2.9.2"; // A conversion for the current internal version# } return(ver); }
private void ShowVersion() { // init engine mRtcEngine = IRtcEngine.GetEngine(AppID); // enable log mRtcEngine.SetLogFilter(LOG_FILTER.DEBUG | LOG_FILTER.INFO | LOG_FILTER.WARNING | LOG_FILTER.ERROR | LOG_FILTER.CRITICAL); GameObject textVersionGameObject = GameObject.Find("VersionText"); textVersionGameObject.GetComponent <Text>().text = "SDK Version : " + IRtcEngine.GetSdkVersion(); }
void ShowVersion() { GameObject go = GameObject.Find("VersionText"); if (go != null) { Text text = go.GetComponent <Text>(); var engine = IRtcEngine.GetEngine(AppID); Debug.Assert(engine != null, "Failed to get engine, appid = " + AppID); text.text = IRtcEngine.GetSdkVersion(); } }
private AgoraVideoController() { Debug_Log("Agora IRtcEngine Version : " + IRtcEngine.GetSdkVersion()); QualitySettings.vSyncCount = 0; Application.targetFrameRate = 30; mRtcEngine = IRtcEngine.GetEngine(Tanks.GameSettings.s_Instance.AgoraAppId); Debug.Assert(mRtcEngine != null, "Can not create Agora RTC Engine instance!"); if (mRtcEngine != null) { agoraAPI = new AgoraApiHandlersImpl(mRtcEngine); } Setup(); }
public string getSdkVersion() { string ver = IRtcEngine.GetSdkVersion(); if (ver == "2.9.1.45") { ver = "2.9.2"; } else { if (ver == "2.9.1.46") { ver = "2.9.2.1"; } } return(ver); }
void LoadAgoraKit() { mRtcEngine = IRtcEngine.GetEngine(ApplicationModal.AppId); mRtcEngine.SetLogFilter(LOG_FILTER.DEBUG); string rtcLogFile = LocalLogFilePath(); mRtcEngine.SetLogFile(rtcLogFile); Debug.Log(string.Format("SetLogFile {0}", rtcLogFile)); versionText.GetComponent <Text> ().text = "Version : " + IRtcEngine.GetSdkVersion(); Debug.Log(" SDK version = " + IRtcEngine.GetSdkVersion()); if (ApplicationModal.AudioGameProfile == 0) { mRtcEngine.SetChannelProfile(CHANNEL_PROFILE.CHANNEL_PROFILE_COMMUNICATION); } else { mRtcEngine.SetChannelProfile(CHANNEL_PROFILE.CHANNEL_PROFILE_LIVE_BROADCASTING); } mRtcEngine.EnableSoundPositionIndication(true); mRtcEngine.EnableAudioVolumeIndication(200, 3, true); LoadEngineCallbacks(); }
public string getSdkVersion() { return(IRtcEngine.GetSdkVersion()); }
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 OnApplicationQuit() //{ // if (mRtcEngine != null) // { // IRtcEngine.Destroy(); // } //} public string getSdkVersion() { string ver = IRtcEngine.GetSdkVersion(); return(ver); }
// 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); }
// 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); } }
void Channel2OnJoinChannelSuccessHandler(string channelId, uint uid, int elapsed) { logger.UpdateLog(string.Format("sdk version: ${0}", IRtcEngine.GetSdkVersion())); logger.UpdateLog(string.Format("onJoinChannelSuccess channelId: {0}, uid: {1}, elapsed: {2}", channelId, uid, elapsed)); makeVideoView(channelId, 0); }