/**
     * 加入房间(默认为世界大厅)
     */
    public void JoinChannel()
    {
        if (!isConnected)
        {
            joinChannel.GetComponent <Image>().sprite = micOpen;
            string channelName = "YNetwork";

            textScollController.addText("<color=green>YNetwork语音串流已连接!</color>");

            Debug.Log(string.Format("tap joinChannel with channel name {0}", channelName));

            if (string.IsNullOrEmpty(channelName))
            {
                return;
            }

            mRtcEngine.JoinChannel(channelName, "extra", 0);
        }
        else
        {
            isConnected = false;
            mRtcEngine.LeaveChannel();
            textScollController.addText("<color=green>YNetwork语音串流已断开!</color>");
            joinChannel.GetComponent <Image>().sprite = micClose;
        }
    }
Beispiel #2
0
    private void JoinChannel()
    {
        Debug.LogFormat("Joining Channel...");

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

        //Add our callbacks to handle Agora events
        mRtcEngine.OnJoinChannelSuccess += OnJoinChannelSuccess;
        mRtcEngine.OnUserJoined         += OnUserJoined;
        mRtcEngine.OnUserOffline        += OnUserLeave;
        mRtcEngine.OnLeaveChannel       += OnLeaveChannel;

        joinButton.onClick.RemoveListener(JoinChannel);
        joinButton.onClick.AddListener(LeaveChannel);
        buttonText.text = "En vivo";

        if (string.IsNullOrEmpty(channelName))
        {
            return;
        }

        mRtcEngine.JoinChannel(channelName, "extra", 0);
    }
    public void join(string channel)
    {
        Debug.Log("calling join (channel = " + channel + ")");

        if (mRtcEngine == null)
        {
            return;
        }

        // set callbacks (optional)
        mRtcEngine.OnJoinChannelSuccess = onJoinChannelSuccess;
        mRtcEngine.OnUserJoined         = onUserJoined;
        mRtcEngine.OnUserOffline        = onUserOffline;

        // enable video
        mRtcEngine.EnableVideo();
        // allow camera output callback
        mRtcEngine.EnableVideoObserver();
        //mRtcEngine.EnableLocalVideo(false);
        CameraCapturerConfiguration config = new CameraCapturerConfiguration();

        config.preference      = CAPTURER_OUTPUT_PREFERENCE.CAPTURER_OUTPUT_PREFERENCE_AUTO;
        config.cameraDirection = CAMERA_DIRECTION.CAMERA_REAR;
        mRtcEngine.SetCameraCapturerConfiguration(config);

        mRtcEngine.SetExternalVideoSource(true, false);

        // join channel
        mRtcEngine.JoinChannel(channel, null, 0);

        // Optional: if a data stream is required, here is a good place to create it
        int streamID = mRtcEngine.CreateDataStream(true, true);

        Debug.Log("initializeEngine done, data stream id = " + streamID);
    }
    public void join(string channel)
    {
        Debug.Log("calling join (channel = " + channel + ")");

        if (mRtcEngine == null)
        {
            return;
        }

        // set callbacks (optional)
        mRtcEngine.OnJoinChannelSuccess = onJoinChannelSuccess;
        mRtcEngine.OnUserJoined         = onUserJoined;
        mRtcEngine.OnUserOffline        = onUserOffline;

        // enable video
        mRtcEngine.EnableVideo();
        // allow camera output callback
        mRtcEngine.EnableVideoObserver();

        // join channel
        mRtcEngine.JoinChannel(channel, null, 0);

        // Optional: if a data stream is required, here is a good place to create it
        int streamID = mRtcEngine.CreateDataStream(true, true);

        Debug.Log("initializeEngine done, data stream id = " + streamID);
    }
    //Agora Audio Engine
    public void JoinChannel()
    {
        if (mRtcEngine == null)
        {
            Debug.Log("no mRtcEngine!");
            return;
        }

        mRtcEngine.JoinChannel(ApplicationModal.ChannelName, "", 0);
        isInAgoraAudio = true;

        if (ApplicationModal.AudioGameProfile == 1)
        {
        #if UNITY_IOS || UNITY_ANDROID
            mRtcEngine.SetClientRole(CLIENT_ROLE.BROADCASTER);
        #else
            mRtcEngine.SetClientRole(CLIENT_ROLE.AUDIENCE, null);
        #endif
        }
        else if (ApplicationModal.AudioGameProfile == 2)
        {
        #if UNITY_IOS || UNITY_ANDROID
            mRtcEngine.SetClientRole(CLIENT_ROLE.AUDIENCE);
        #else
            mRtcEngine.SetClientRole(CLIENT_ROLE.AUDIENCE, null);
        #endif
        }

        SetLocalVoicePitch(pitchSlider.PitchValue());
        AdjustRecordingSignalVolume(voiceSlider.VoiceValue());
        AdjustAudioMixingVolume(bgmSlider.BGMValue());
        SetEffectsVolume(effectSlider.EffectValue());
    }
    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);
    }
Beispiel #7
0
    public void Join()
    {
        //JoinInfo.Name = txtName.text;
        //JoinInfo.ChannelId = txtChannelId.text;
        //JoinInfo.AudioOnly = chkAudioOnly.isOn;
        //JoinInfo.ReceiveOnly = chkReceiveOnly.isOn;
        //JoinInfo.CaptureScreen = chkCaptureScreen.isOn;
        //JoinInfo.Simulcast = chkSimulcast.isOn;

        //switch (cmbMode.value)
        //{
        //    default:
        //    case 0:
        //        JoinInfo.Mode = Mode.Sfu;
        //        break;
        //    case 1:
        //        JoinInfo.Mode = Mode.Mcu;
        //        break;
        //    case 2:
        //        JoinInfo.Mode = Mode.Peer;
        //        break;
        //}

        if (mRtcEngine != null)
        {
            mRtcEngine.JoinChannel(txtChannelId.text);
            SceneManager.LoadScene("Channel");
        }

        //if (!string.IsNullOrEmpty(JoinInfo.ChannelId))
        //{
        //    SceneManager.LoadSceneAsync("Channel");
        //}
    }
Beispiel #8
0
        /// <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);
                }
            });
        }
        //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);
                }
            }
                                             );
        }
Beispiel #10
0
        private void Button1_Click(object sender, EventArgs e)
        {
            String channel_name = textBox1.Text;

            if (channel_name.Length == 0)
            {
                MessageBox.Show("Channel name can't be empty!");
                return;
            }

            re_.EnableVideo();
            int h_wnd = panel1.Handle.ToInt32();

            re_.SetupLocalVideo(h_wnd, 2, 0, new IntPtr());

            re_.SetParameter("rtc.channel_mode", 0);

            if (checkBox2.Checked)
            {
                // local video frame raw data handler, the raw data format is YUV420
                re_.onCaptureVideoFrame = OnCaptureVideoFrameRawHandler;
                // For remote video frame raw data handler, use onRenderVideoFrameRaw.
                re_.onRenderVideoFrame = OnRenderVideoFrameRawHandler;

                // Init video frame buffer list for thread changing.
                mutexVideoFrameRawHandlerParam_ = new Mutex();
                usingVideoFrameRawHandlerParam_ = new List <VideoFrameRawHandlerParam>();
                unUseVideoFrameRawHandlerParam_ = new List <VideoFrameRawHandlerParam>();
            }

            is_client_broadcaster_ = checkBox1.Checked;
            re_.JoinChannel(channel_name, "", 0);
        }
Beispiel #11
0
 public void Join()
 {
     mRtcEngine.EnableVideo();
     mRtcEngine.EnableVideoObserver();
     myView.SetEnable(true);
     mRtcEngine.JoinChannel(ChannelName, "", 0);
 }
    public void join(string channel)
    {
        Debug.Log("calling join (channel = " + channel + ")");

        if (mRtcEngine == null)
        {
            return;
        }

        // set callbacks (optional)
        mRtcEngine.OnJoinChannelSuccess = onJoinChannelSuccess;
        mRtcEngine.OnUserJoined         = onUserJoined;
        mRtcEngine.OnUserOffline        = onUserOffline;



        // enable video
        mRtcEngine.EnableVideo();
        // allow camera output callback
        mRtcEngine.EnableVideoObserver();

        // join channel
        mRtcEngine.JoinChannel(channel, null, 0);

        Debug.Log("initializeEngine done");
    }
 public void JoinChannel(string channelName, uint playerId = 0)
 {
     //mRtcEngine.EnableVideo();
     //mRtcEngine.EnableVideoObserver();
     mRtcEngine.JoinChannel(channelName, "extra", playerId); // join the channel with given match name
     Debug_Log(playerId.ToString() + " joining channel:" + channelName);
 }
    public void JoinChannelButton()
    {
        if (mRtcEngine != null)
        {
            mRtcEngine.JoinChannel(channelNameText.text);

            SceneManager.LoadScene("Channel");
        }
    }
Beispiel #15
0
 public void OnJoinButtonPress()
 {
     print("trying to press join button");
     if (photonView.isMine)
     {
         print("join button pressed");
         rtcEngine.JoinChannel(otherChannel, null, localuserID);
     }
 }
Beispiel #16
0
    //选择自己的UID之后进入聊天室
    public void OnNumberClick(Button button)
    {
        Gameobjects.Members.SetActive(false);
        Gameobjects.RoomContent.SetActive(true);

        uint uid = uint.Parse(button.name.ToString());

        mRtcEngine.MuteLocalAudioStream(true);
        mRtcEngine.JoinChannel("Storm", null, uid);
    }
    void JoinChannel(string channelName)
    {
        Debug.Log(string.Format("tap joinChannel with channel name {0}", channelName));

        if (string.IsNullOrEmpty(channelName))
        {
            return;
        }

        mRtcEngine.JoinChannel(channelName, "extra", 9527);
    }
Beispiel #18
0
    void InitializeAgora()
    {
        rtcEngine = IRtcEngine.GetEngine(appID);

        rtcEngine.OnUserJoined          += OnUserJoinedHandler;
        rtcEngine.OnLocalUserRegistered += OnLocalUserRegisteredHandler;
        rtcEngine.EnableVideo();
        rtcEngine.EnableVideoObserver();

        rtcEngine.JoinChannel("agora", null, 0);
    }
Beispiel #19
0
 void Join()
 {
     mRtcEngine.EnableVideo();
     mRtcEngine.EnableVideoObserver();
     mRtcEngine.SetExternalVideoSource(true, false);
     // myView.SetEnable(true);
     mRtcEngine.JoinChannel(ChannelName, "", 0);
     mRect = new Rect(0, 0, Screen.width, Screen.height);
     // Creates a texture of the rectangle you create.
     mTexture = new Texture2D((int)mRect.width, (int)mRect.height, TextureFormat.BGRA32, false);
 }
Beispiel #20
0
    public void JoinChannel()
    {
        string channelName = SaveRoomString.roomname;

        Debug.Log(string.Format("tap joinChannel with channel name {0}", channelName));

        if (string.IsNullOrEmpty(channelName))
        {
            return;
        }
        mRtcEngine.JoinChannel(channelName, "extra", 0);
    }
Beispiel #21
0
    public void JoinChannel()
    {
        string channelName = mChannelNameInputField.text.Trim();

        Debug.Log(string.Format("tap joinChannel with channel name {0}", channelName));

        if (string.IsNullOrEmpty(channelName))
        {
            return;
        }

        mRtcEngine.JoinChannel(channelName, "extra", 0);
    }
    public void JoinChannel()
    {
        channelName = mChannelNameInputField.text.Trim();

        Debug.Log(string.Format("tap joinChannel with channel name {0}", channelName));

        if (string.IsNullOrEmpty(channelName))
        {
            return;
        }

        mRtcEngine.JoinChannel(channelName, "extra", 0);
        // mRtcEngine.JoinChannelByKey ("YOUR_CHANNEL_KEY", channelName, "extra", 9527);
    }
Beispiel #23
0
    public void JoinRemoteChannel(string remoteChannelName)
    {
        if (!photonView.isMine)
        {
            return;
        }

        mRtcEngine.LeaveChannel();

        mRtcEngine.JoinChannel(remoteChannelName, null, myUID);
        mRtcEngine.EnableVideo();
        mRtcEngine.EnableVideoObserver();

        channel = remoteChannelName;
    }
    public int JoinRemoteChannel(string remoteChannelName)
    {
        int joinSuccess = mRtcEngine.JoinChannel(remoteChannelName, null, myUID);

        if (joinSuccess == 0)
        {
            print("successful join");
        }
        else
        {
            print("Join UNSUCCESSFUL");
        }

        return(joinSuccess);
    }
Beispiel #25
0
    public void joinAgoraChannel()
    {
        if (mRtcEngine == null)
        {
            UnityEngine.Debug.LogError("mRtcEngine is null");
            return;
        }

        audioRawDataManager.RegisteAudioRawDataObserver();

        Debug.Log("join channel with uid " + GameState.Instance.UDID);

        //everyone join test channel
        mRtcEngine.JoinChannel("silicon", string.Empty, GameState.Instance.UDID);
    }
 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));
 }
Beispiel #27
0
    public void joinChannel(string channel)
    {
        if (ReferenceEquals(RtcEngine, null))
        {
            return;
        }

        RtcEngine.OnFirstLocalVideoFrame         = onFirstLocalVideoFrame;
        RtcEngine.OnUserJoined                   = onUserJoined;
        RtcEngine.OnFirstRemoteVideoFrameDecoded = onFirstRemoteVideoFrameDecoded;
        RtcEngine.OnUserOffline                  = onUserOffline;

        RtcEngine.EnableVideo();
        RtcEngine.SetVideoProfile(VideoProfile, true);
        RtcEngine.JoinChannel(channel, MyUserID);
    }
Beispiel #28
0
    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 square video profile
        VideoEncoderConfiguration config = new VideoEncoderConfiguration();

        config.dimensions.width      = 480;
        config.dimensions.height     = 480;
        config.frameRate             = FRAME_RATE.FRAME_RATE_FPS_15;
        config.bitrate               = 800;
        config.degradationPreference = DEGRADATION_PREFERENCE.MAINTAIN_QUALITY;
        mRtcEngine.SetVideoEncoderConfiguration(config);

        // 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 unique UID and returns it in the OnJoinChannelSuccess callback.
        mRtcEngine.JoinChannel(channel, null, 0);
    }
    public void joinChannel(string channelname)
    {
        Debug.Log("joining channel " + channelname);

        if (mRtcEngine == null)
        {
            Debug.Log("engine needs to be initialized");
            return;
        }
        mRtcEngine.OnJoinChannelSuccess = OnJoinChannelSuccess;
        mRtcEngine.OnUserJoined         = OnUserJoined;
        mRtcEngine.OnUserOffline        = OnUserOffline;


        mRtcEngine.EnableVideo();
        mRtcEngine.EnableVideoObserver();
        mRtcEngine.JoinChannel(channelname, null, 0);
    }
    private void JoinChannel(string channelName, uint uid)
    {
        Debug.Log(string.Format("Tap joinChannel with channel name {0}", channelName));

        if (string.IsNullOrEmpty(channelName))
        {
            return;
        }
        if (mRtcEngine != null)
        {
            mRtcEngine.JoinChannel(channelName);
            mRtcEngine.EnableAudioVolumeIndication(500, 3, true);
        }
        else
        {
            Invoke(channelName, 1);
        }
    }