void Start() { if (!photonView.isMine) { return; } playerVideoList = new List <GameObject>(); // Setup Agora Engine and Callbacks. if (mRtcEngine != null) { IRtcEngine.Destroy(); } originalChannel = channel; // -- These are all necessary steps to initialize the Agora engine -- // // Initialize Agora engine mRtcEngine = IRtcEngine.GetEngine(appID); // Setup our callbacks (there are many other Agora callbacks, however these are the calls we need). mRtcEngine.OnJoinChannelSuccess = OnJoinChannelSuccessHandler; mRtcEngine.OnUserJoined = OnUserJoinedHandler; mRtcEngine.OnLeaveChannel = OnLeaveChannelHandler; mRtcEngine.OnUserOffline = OnUserOfflineHandler; // Your video feed will not render if EnableVideo() isn't called. mRtcEngine.EnableVideo(); mRtcEngine.EnableVideoObserver(); // By setting our UID to "0" the Agora Engine creates a new one and assigns it. mRtcEngine.JoinChannel(channel, null, 0); }
// load agora engine public void loadEngine(string appId) { // start sdk Debug.Log("initializeEngine"); if (mRtcEngine != null) { Debug.Log("Engine exists. Please unload it first!"); return; } Debug.Log("ScreenShare Activated"); mRtcEngine = IRtcEngine.GetEngine(appId); // ������־����ȼ��� mRtcEngine.SetLogFilter(LOG_FILTER.DEBUG | LOG_FILTER.INFO | LOG_FILTER.WARNING | LOG_FILTER.ERROR | LOG_FILTER.CRITICAL); // ������Ƶģ�顣 mRtcEngine.EnableVideo(); // ������Ƶ�۲����� mRtcEngine.EnableVideoObserver(); // �����ⲿ��ƵԴ�� mRtcEngine.SetExternalVideoSource(true, false); // �����蹲������Ļ���� mRect = new Rect(0, 0, Screen.width, Screen.height); // ���� Texture�� mTexture = new Texture2D((int)mRect.width, (int)mRect.height, TextureFormat.BGRA32, false); }
void Start() { muteButton.gameObject.SetActive(false); leaveChannel.gameObject.SetActive(false); joinChannel.gameObject.SetActive(true); if (!Permission.HasUserAuthorizedPermission(Permission.Microphone)) { Permission.RequestUserPermission(Permission.Microphone); } mRtcEngine = IRtcEngine.GetEngine(appId); mRtcEngine.SetChannelProfile(CHANNEL_PROFILE.CHANNEL_PROFILE_COMMUNICATION); mRtcEngine.OnJoinChannelSuccess += (string channelName, uint uid, int elapsed) => { muteButton.gameObject.SetActive(true); leaveChannel.gameObject.SetActive(true); joinChannel.gameObject.SetActive(false); }; mRtcEngine.OnLeaveChannel += (RtcStats stats) => { muteButton.gameObject.SetActive(false); leaveChannel.gameObject.SetActive(false); joinChannel.gameObject.SetActive(true); }; }
void Start() { //初始化 mRtcEngine = IRtcEngine.GetEngine(appId); mRtcEngine.SetChannelProfile(CHANNEL_PROFILE.GAME_FREE_MODE); mRtcEngine.EnableAudioVolumeIndication(200, 3); }
/// <summary> /// Populates game settings for broadcast to clients and attempts to start matchmaking server session. /// </summary> private void StartMatchmakingGame() { GameSettings settings = GameSettings.s_Instance; settings.SetMapIndex(m_MapSelect.currentIndex); settings.SetModeIndex(m_ModeSelect.currentIndex); m_MenuUi.ShowConnectingModal(false); Debug.Log(GetGameName()); m_NetManager.StartMatchmakingGame(GetGameName(), (success, matchInfo) => { if (!success) { m_MenuUi.ShowInfoPopup("Failed to create game.", null); } else { m_MenuUi.HideInfoPopup(); m_MenuUi.ShowLobbyPanel(); // Agora.io Implimentation var channelName = m_MatchNameInput.text; // testing --> prod use: m_MatchNameInput.text IRtcEngine mRtcEngine = IRtcEngine.GetEngine(AgoraInterface.appId); // Get a reference to the Engine mRtcEngine.JoinChannel(channelName, "extra", 0); // join the channel with given match name // testing string joinChannelMessage = string.Format("joining channel: {0}", channelName); Debug.Log(joinChannelMessage); } }); }
void Start() { #if (UNITY_2018_3_OR_NEWER) if (Permission.HasUserAuthorizedPermission(Permission.Microphone)) { } else { Permission.RequestUserPermission(Permission.Microphone); } #endif // muteButton.onClick.AddListener(MuteButtonTapped); mRtcEngine = IRtcEngine.GetEngine(appId); JoinChannel(); mRtcEngine.OnJoinChannelSuccess += (string channelName, uint uid, int elapsed) => { // muteButton.gameObject.SetActive(true); }; mRtcEngine.OnLeaveChannel += (RtcStats stats) => { // muteButton.gameObject.SetActive(false) ; /* if (isMuted) * { * MuteButtonTapped(); * }*/ }; mRtcEngine.OnUserMutedAudio += (uint uid, bool muted) => { string userMutedMessage = string.Format("onUserMuted callback uid {0} {1}", uid, muted); Debug.Log(userMutedMessage); }; }
//Fired when player clicks join private void JoinMatch(NetworkID networkId, String matchName) { MainMenuUI menuUi = MainMenuUI.s_Instance; menuUi.ShowConnectingModal(true); m_NetManager.JoinMatchmakingGame(networkId, (success, matchInfo) => { //Failure flow if (!success) { menuUi.ShowInfoPopup("Failed to join game.", null); } //Success flow else { menuUi.HideInfoPopup(); menuUi.ShowInfoPopup("Entering lobby..."); m_NetManager.gameModeUpdated += menuUi.ShowLobbyPanelForConnection; // Agora.io Implimentation var channelName = matchName; // testing --> prod use: matchName IRtcEngine mRtcEngine = IRtcEngine.GetEngine(AgoraInterface.appId); // Get a reference to the Engine mRtcEngine.JoinChannel(channelName, "extra", 0); // join the channel with given match name // testing string joinChannelMessage = string.Format("joining channel: {0}", channelName); Debug.Log(joinChannelMessage); } } ); }
public void HandlePreviewClick(Button button) { if (!_initialized) { return; } if (_echoTesting) { Debug.LogWarning("Echo testing! can't do preview right now!"); return; } var engine = IRtcEngine.GetEngine(AppID); _previewing = !_previewing; previewImage.GetComponent <VideoSurface>().SetEnable(_previewing); if (_previewing) { engine.EnableVideo(); engine.EnableVideoObserver(); engine.StartPreview(); button.GetComponentInChildren <Text>().text = "StopPreview"; // VideoManager only works after video enabled CheckDevices(engine); } else { engine.DisableVideo(); engine.DisableVideoObserver(); engine.StopPreview(); button.GetComponentInChildren <Text>().text = "StartPreview"; } }
void InitEngine() { mRtcEngine = IRtcEngine.GetEngine(APP_ID); mRtcEngine.SetLogFile("log.txt"); mRtcEngine.SetChannelProfile(CHANNEL_PROFILE.CHANNEL_PROFILE_LIVE_BROADCASTING); mRtcEngine.SetClientRole(CLIENT_ROLE_TYPE.CLIENT_ROLE_BROADCASTER); mRtcEngine.SetVideoEncoderConfiguration(new VideoEncoderConfiguration { dimensions = new VideoDimensions { width = 720, height = 640 }, frameRate = FRAME_RATE.FRAME_RATE_FPS_24 }); mRtcEngine.EnableAudio(); mRtcEngine.EnableVideo(); mRtcEngine.EnableVideoObserver(); mRtcEngine.OnJoinChannelSuccess += OnJoinChannelSuccessHandler; mRtcEngine.OnLeaveChannel += OnLeaveChannelHandler; mRtcEngine.OnWarning += OnSDKWarningHandler; mRtcEngine.OnError += OnSDKErrorHandler; mRtcEngine.OnConnectionLost += OnConnectionLostHandler; mRtcEngine.OnUserJoined += OnUserJoinedHandler; mRtcEngine.OnUserOffline += OnUserOfflineHandler; mRtcEngine.OnStreamPublished += OnStreamPublishedHandler; mRtcEngine.OnRtmpStreamingStateChanged += OnRtmpStreamingStateChangedHandler; mRtcEngine.OnRtmpStreamingEvent += OnRtmpStreamingEventHandler; }
/// <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); // enable log mRtcEngine.SetLogFilter(LOG_FILTER.DEBUG | LOG_FILTER.INFO | LOG_FILTER.WARNING | LOG_FILTER.ERROR | LOG_FILTER.CRITICAL); }
void SetupAgora() { mRtcEngine = IRtcEngine.GetEngine(AppID); mRtcEngine.OnUserJoined = OnUserJoined; mRtcEngine.OnUserOffline = OnUserOffline; mRtcEngine.OnJoinChannelSuccess = OnJoinChannelSuccessHandler; mRtcEngine.OnLeaveChannel = OnLeaveChannelHandler; }
void Start() { if (mRtcEngine == null) { mRtcEngine = IRtcEngine.GetEngine(appID); mRtcEngine.EnableVideo(); mRtcEngine.EnableVideoObserver(); } }
void InitRtcEngine() { mRtcEngine = IRtcEngine.GetEngine(APP_ID); mRtcEngine.SetLogFile("log.txt"); mRtcEngine.OnJoinChannelSuccess += OnJoinChannelSuccessHandler; mRtcEngine.OnLeaveChannel += OnLeaveChannelHandler; mRtcEngine.OnWarning += OnSDKWarningHandler; mRtcEngine.OnError += OnSDKErrorHandler; mRtcEngine.OnConnectionLost += OnConnectionLostHandler; }
void InitRtcEngine() { mRtcEngine = IRtcEngine.GetEngine(APP_ID); mRtcEngine.SetExternalAudioSink(true, SAMPLE_RATE, CHANNEL); mRtcEngine.SetLogFile("log.txt"); mRtcEngine.OnJoinChannelSuccess += OnJoinChannelSuccessHandler; mRtcEngine.OnLeaveChannel += OnLeaveChannelHandler; mRtcEngine.OnWarning += OnSDKWarningHandler; mRtcEngine.OnError += OnSDKErrorHandler; mRtcEngine.OnConnectionLost += OnConnectionLostHandler; }
void InitializeAgora() { rtcEngine = IRtcEngine.GetEngine(appID); rtcEngine.OnUserJoined += OnUserJoinedHandler; rtcEngine.OnLocalUserRegistered += OnLocalUserRegisteredHandler; rtcEngine.EnableVideo(); rtcEngine.EnableVideoObserver(); rtcEngine.JoinChannel("agora", null, 0); }
// Use this for initialization void Start() { Agora = IRtcEngine.GetEngine(appId); Agora.EnableVideo(); if (OnInitialize != null) { OnInitialize(); } }
// Start is called before the first frame update void OnEnable() { // Agora.io Implimentation IRtcEngine mRtcEngine = IRtcEngine.GetEngine(AgoraInterface.appId); // Get a reference to the Engine if (mRtcEngine != null) { Debug.Log("Leaving Channel"); mRtcEngine.LeaveChannel();// leave the channel } }
void MeditationRoomIsFullSocket(SocketIOEvent e) { meditationSessionStarted = true; RoomData roomData = JsonUtility.FromJson <RoomData>(e.data.ToString()); mRtcEngine = IRtcEngine.GetEngine(roomData.agoraIoVoiceKey); JoinChannel(roomData.roomId); socket.Emit("get-students-data"); }
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(); }
public void loadEngine() { if (mRtcEngine != null) { Debug.Log("Engine already exists, please unload it"); return; } mRtcEngine = IRtcEngine.GetEngine(appId); mRtcEngine.SetLogFilter(LOG_FILTER.DEBUG); Debug.Log("initializing engine: " + mRtcEngine); }
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(); } }
//------------------------------------------------------// //-------------------AGORA JOIN/LEAVE-------------------// //------------------------------------------------------// //Load / Unload Engine. Call this to init / destroy Agora public void loadEngine(string appId) { Debug.Log("initializeEngine"); if (mRtcEngine != null) { Debug.Log("Engine exists. Please unload it first!"); return; } // 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); }
void InitRtcEngine() { mRtcEngine = IRtcEngine.GetEngine(APP_ID); mRtcEngine.SetAudioProfile(AUDIO_PROFILE_TYPE.AUDIO_PROFILE_MUSIC_HIGH_QUALITY, AUDIO_SCENARIO_TYPE.AUDIO_SCENARIO_GAME_STREAMING); mRtcEngine.SetExternalAudioSource(true, SAMPLE_RATE, CHANNEL); mRtcEngine.SetLogFile("log.txt"); mRtcEngine.OnJoinChannelSuccess += OnJoinChannelSuccessHandler; mRtcEngine.OnLeaveChannel += OnLeaveChannelHandler; mRtcEngine.OnWarning += OnSDKWarningHandler; mRtcEngine.OnError += OnSDKErrorHandler; mRtcEngine.OnConnectionLost += OnConnectionLostHandler; }
private bool LoadEngine(string appId, AREA_CODE areaCode) { UnloadEngine(); _RtcEngine = IRtcEngine.GetEngine(new RtcEngineConfig(appId, new LogConfig(), areaCode)); if (_RtcEngine == null) { return(false); } _RtcEngine.SetLogFilter(LOG_FILTER.DEBUG | LOG_FILTER.INFO | LOG_FILTER.WARNING | LOG_FILTER.ERROR | LOG_FILTER.CRITICAL); return(true); }
public void loadEngine() { //start sdk Debug.Log("Initializing Engine"); if (mrtcEngine != null) { Debug.Log("Engine already Exits...please unload"); return; } //init rtc engine mrtcEngine = IRtcEngine.GetEngine(appId); //set log level mrtcEngine.SetLogFilter(LOG_FILTER.DEBUG); }
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(); }
private void InitEngine() { mRtcEngine = IRtcEngine.GetEngine(APP_ID); mRtcEngine.SetLogFile("log.txt"); mRtcEngine.EnableAudio(); mRtcEngine.EnableVideo(); mRtcEngine.EnableVideoObserver(); mRtcEngine.OnJoinChannelSuccess += OnJoinChannelSuccessHandler; mRtcEngine.OnLeaveChannel += OnLeaveChannelHandler; mRtcEngine.OnWarning += OnSDKWarningHandler; mRtcEngine.OnError += OnSDKErrorHandler; mRtcEngine.OnConnectionLost += OnConnectionLostHandler; mRtcEngine.OnUserJoined += OnUserJoinedHandler; mRtcEngine.OnUserOffline += OnUserOfflineHandler; }
public IRtcEngine loadEngine() { if (!ReferenceEquals(RtcEngine, null)) { return(RtcEngine); } // 初始化TTTRtcEngine RtcEngine = IRtcEngine.GetEngine(AppID); // // enable log // RtcEngine.SetLogFilter (LOG_FILTER.DEBUG | LOG_FILTER.INFO | LOG_FILTER.WARNING | LOG_FILTER.ERROR | LOG_FILTER.CRITICAL); return(RtcEngine); }
void InitRtcEngine() { mRtcEngine = IRtcEngine.GetEngine(APP_ID); mRtcEngine.SetLogFile("log.txt"); mRtcEngine.OnJoinChannelSuccess += OnJoinChannelSuccessHandler; mRtcEngine.OnLeaveChannel += OnLeaveChannelHandler; mRtcEngine.OnWarning += OnSDKWarningHandler; mRtcEngine.OnError += OnSDKErrorHandler; mRtcEngine.OnConnectionLost += OnConnectionLostHandler; GetAudioRecordingDevice(); GetAudioPlaybackDevice(); GetVideoDeviceManager(); SetCurrentDevice(); SetCurrentDeviceVolume(); ReleaseDeviceManager(); }
void Start() { audio = false; video = false; rtcEngine = IRtcEngine.GetEngine(appId); print(rtcEngine); rtcEngine.OnJoinChannelSuccess = OnJoinChannelSuccess; rtcEngine.OnUserJoined = OnUserJoined; rtcEngine.OnUserOffline = OnUserOffline; rtcEngine.OnLeaveChannel = OnLeaveChannel; rtcEngine.EnableVideo(); rtcEngine.EnableVideoObserver(); rtcEngine.SetLogFilter(LOG_FILTER.DEBUG | LOG_FILTER.INFO | LOG_FILTER.WARNING | LOG_FILTER.ERROR | LOG_FILTER.CRITICAL); print(ChannelManager.ChannelName); print(rtcEngine.JoinChannel(ChannelManager.ChannelName, null, 0)); }