Ejemplo n.º 1
0
 public void LeaveChannel()
 {
     Debug_Log("Leaving channel now....");
     mRtcEngine.DisableVideo();
     mRtcEngine.DisableVideoObserver();
     mRtcEngine.LeaveChannel();
 }
Ejemplo n.º 2
0
        public void Leave()
        {
            _IsJoined = false;

            if (_RtcEngine == null)
            {
                return;
            }

            _RtcEngine.LeaveChannel();
            _RtcEngine.DisableAudio();
            _RtcEngine.DisableVideo();
            _RtcEngine.DisableVideoObserver();
            _VideoDeviceManager.ReleaseAVideoDeviceManager();
        }
Ejemplo n.º 3
0
 public static void DisableVideo()
 {
     if (mRtcEngine != null)
     {
         mRtcEngine.DisableVideo();
         isVideo = false;
     }
 }
Ejemplo n.º 4
0
    void endCall()
    {
        Debug.Log("End call.");
        mRtcEngine.EnableLocalVideo(false);
        mRtcEngine.DisableVideo();
        // leave channel
        mRtcEngine.LeaveChannel();
        // deregister video frame observers in native-c code
        mRtcEngine.DisableVideoObserver();

        IRtcEngine.Destroy();
        mRtcEngine = null;
    }
Ejemplo n.º 5
0
 public void EnableVideo(bool pauseVideo)
 {
     if (mRtcEngine != null)
     {
         if (!pauseVideo)
         {
             mRtcEngine.EnableVideo();
         }
         else
         {
             mRtcEngine.DisableVideo();
         }
     }
 }
Ejemplo n.º 6
0
    void SetupUI()
    {
        GameObject go = GameObject.Find("MyView");

        myView = go.AddComponent <VideoSurface>();

        go = GameObject.Find("LeaveButton");
        go.GetComponent <Button>().onClick.AddListener(() =>
        {
            mRtcEngine.LeaveChannel();
            mRtcEngine.DisableVideo();
            mRtcEngine.DisableVideoObserver();
        });

        go = GameObject.Find("JoinButton");
        go.GetComponent <Button>().onClick.AddListener(() =>
        {
            mRtcEngine.EnableVideo();
            mRtcEngine.EnableVideoObserver();
            myView.SetEnable(true);
            mRtcEngine.JoinChannel(ChannelName, "", 0);
        });
    }
Ejemplo n.º 7
0
 public void Leave()
 {
     mRtcEngine.LeaveChannel();
     mRtcEngine.DisableVideo();
     mRtcEngine.DisableVideoObserver();
 }
Ejemplo n.º 8
0
    //Called to join or leave a session. Engine must be loaded first!
    public void join(string channel)
    {
        if (String.IsNullOrEmpty(channel))
        {
            Debug.LogWarning("Empty channel name. Ignoring join request."); return;
        }

        loadEngine(AppID); // load engine

        if (mRtcEngine == null)
        {
            return;
        }
        Debug.Log("calling join (channel = " + channel + ")");

        // set callbacks (optional)
        mRtcEngine.OnJoinChannelSuccess = onJoinChannelSuccess;
        mRtcEngine.OnLeaveChannel       = onLeaveChannel;
        mRtcEngine.OnUserJoined         = onUserJoined;
        mRtcEngine.OnUserOffline        = onUserOffline;
        mRtcEngine.OnStreamMessage      = onStreamMessage;
        mRtcEngine.OnRtcStats           = onRtcStats;

        //set timeout timer (optional)
        if (timeout > 0)
        {
            timeoutTimer = timeout; hideWarningLabel();
        }

        //Audio settings
        if (useAudio)
        {
            mRtcEngine.EnableAudio();                              // enable audio in general
            mRtcEngine.EnableLocalAudio(!muteLocalAudio);          //controls sending local out HARD STOP

            mRtcEngine.MuteLocalAudioStream(muteLocalAudio);       //still sending, but not audible
            mRtcEngine.MuteAllRemoteAudioStreams(muteRemoteAudio); //still sending, but not audible

            mRtcEngine.AdjustRecordingSignalVolume(localVolume);
            mRtcEngine.AdjustPlaybackSignalVolume(remoteVolume);
        }
        else
        {
            mRtcEngine.DisableAudio();
        }                                     // disable video in general

        //Begin video feed
        if (useVideo)
        {
            mRtcEngine.EnableVideo();                              // enable video in general
            mRtcEngine.EnableVideoObserver();
            mRtcEngine.EnableLocalVideo(!muteLocalVideo);          //controls sending local out HARD STOP

            mRtcEngine.MuteLocalVideoStream(muteLocalVideo);       //Send local video to remote?
            mRtcEngine.MuteAllRemoteVideoStreams(muteRemoteVideo); //still receiving, but not visible

            //if(muteRemoteVideo) { mRtcEngine.DisableVideoObserver(); } //controls receiving video HARD STOP
            //else                { mRtcEngine.EnableVideoObserver(); }

            //Change Video feed settings
            VideoEncoderConfiguration videoConfig = new VideoEncoderConfiguration();
            videoConfig.dimensions.width  = 1280;
            videoConfig.dimensions.height = 720;
            videoConfig.frameRate         = FRAME_RATE.FRAME_RATE_FPS_15;
            mRtcEngine.SetVideoEncoderConfiguration(videoConfig);

            //WEBCAMS: Show list of all webcam devices
            mRtcEngine.GetVideoDeviceManager().CreateAVideoDeviceManager();
            int deviceCount = mRtcEngine.GetVideoDeviceManager().GetVideoDeviceCount();
            Debug.Log("Video device count: " + deviceCount);
            string deviceName = ""; string deviceId = "";
            for (int i = 0; i < deviceCount; i++)  //Show list of webcams
            {
                mRtcEngine.GetVideoDeviceManager().GetVideoDevice(i, ref deviceName, ref deviceId);
                Debug.Log("Device[i] deviceName = \"" + deviceName + "\" | deviceId = \"" + deviceId + "\"");
            }
            //---Show current video device---
            mRtcEngine.GetVideoDeviceManager().GetCurrentVideoDevice(ref deviceId);
            Debug.Log("CurrentVideoDevice deviceId = \"" + deviceId + "\"");
            //---Pick the first one?---
            mRtcEngine.GetVideoDeviceManager().GetVideoDevice(0, ref deviceName, ref deviceId);
            mRtcEngine.GetVideoDeviceManager().SetVideoDevice(deviceId);
        }
        else
        {
            mRtcEngine.DisableVideo();
        }                                     // disable video in general

        //Join Channel
        UID = mRtcEngine.JoinChannel(channel, null, 0); // join channel

        // Optional: if a data stream is required, here is a good place to create it.
        streamID = mRtcEngine.CreateDataStream(true, true);
        Debug.Log("initializeEngine done, data stream id = " + streamID);

        //Show local video
        showLocalVideo();

        //Hide Join Button and Show Leave button if assigned
        joinButton.SetActive(false);
        leaveButton.SetActive(true);

        //Hide warning label if still there
        hideWarningLabel();
    }