Exemple #1
0
 public void Join()
 {
     mRtcEngine.EnableVideo();
     mRtcEngine.EnableVideoObserver();
     myView.SetEnable(true);
     mRtcEngine.JoinChannel(ChannelName, "", 0);
 }
 void OnLeaveChannelHandler(RtcStats stats)
 {
     myView.SetEnable(false);
     if (remoteView != null)
     {
         remoteView.SetEnable(false);
     }
 }
Exemple #3
0
 void OnLeaveChannelHandler(RtcStats stats)
 {
     myView.SetEnable(false);
     if (remoteView != null)
     {
         remoteView.SetEnable(false);
     }
     Debug.Log("Sending Rating:" + mRtcEngine.Rate(callId, 4, "Rating"));
 }
Exemple #4
0
    protected override void OnUserJoined(uint uid, int elapsed)
    {
        hostCount++;

        if (hostCount == 2)
        {
            host2.SetForUser(uid);
            host2.SetEnable(true);
            RemoteUID = uid;
        }
        else
        {
            return;
        }
    }
    // When a remote user joined, this delegate will be called. Typically
    // create a GameObject to render video on it
    protected virtual void OnUserJoined(uint uid, int elapsed)
    {
        Debug.Log("onUserJoined: uid = " + uid + " elapsed = " + elapsed);

        // find a game object to render video stream from 'uid'
        GameObject go = GameObject.Find(uid.ToString());

        if (!ReferenceEquals(go, null))
        {
            return; // reuse
        }

        // create a GameObject and assign to this new user
        VideoSurface videoSurface = makeImageSurface(uid.ToString());

        if (!ReferenceEquals(videoSurface, null))
        {
            // configure videoSurface
            videoSurface.SetForUser(uid);
            videoSurface.SetEnable(true);
            videoSurface.SetVideoSurfaceType(AgoraVideoSurfaceType.RawImage);
            videoSurface.SetGameFps(30);
            videoSurface.EnableFilpTextureApply(enableFlipHorizontal: true, enableFlipVertical: false);
            UserVideoDict[uid] = videoSurface;
            Vector2 pos = AgoraUIUtils.GetRandomPosition(100);
            videoSurface.transform.localPosition = new Vector3(pos.x, pos.y, 0);
        }
    }
Exemple #6
0
    private void OnUserJoined(uint uid, int elapsed)
    {
        Debug.Log("New user has joined channel with id" + uid);

        // add remote stream to scene

        // create game object
        GameObject go;

        go = GameObject.CreatePrimitive(PrimitiveType.Plane);

        go.name = uid.ToString();

        // configure video surface
        VideoSurface o = go.AddComponent <VideoSurface>();

        o.SetForUser(uid);
        o.mAdjustTransform += OnTransformDelegate;
        o.SetEnable(true);
        o.transform.Rotate(-90.0f, 0.0f, 0.0f);
        float r = Random.Range(-5.0f, 5.0f);

        o.transform.position   = new Vector3(0f, r, 0f);
        o.transform.localScale = new Vector3(0.5f, 0.5f, 1.0f);

        mRemotePeer = uid;
    }
    private void OnUserJoined(uint uid, int elapsed)
    {
        Debug.Log("New user has joined channel with id: " + uid);
        GameObject go = GameObject.CreatePrimitive(PrimitiveType.Plane);

        go.name = uid.ToString();
        VideoSurface o = go.AddComponent <VideoSurface>();

        o.SetForUser(uid);

        //o.mAdjustTransfrom += OnTransformDelegate;
        o.SetEnable(true);
        o.transform.Rotate(-90.0f, 0.0f, 0.0f);
        float r = Random.Range(-5.0f, 5.0f);

        o.transform.position   = new Vector3(0f, r, 0f);
        o.transform.localScale = new Vector3(0.5f, 0.5f, 1.0f);

        mRemotePeer = uid;

        /*Debug.Log("new person join channel " + " " + uid);
         * GameObject go;
         * go = GameObject.CreatePrimitive(PrimitiveType.Plane);
         * go.name = uid.ToString();
         * VideoSurface o = go.AddComponent<VideoSurface>();
         * o.SetForUser(uid);
         * o.mAdjustTransfrom += OnTransformDelegate;
         * o.SetEnable(true);
         * o.transform.Rotate(-90.0f, 0.0f, 0.0f);
         * float r = Random.Range(-5.0f, 5.0f);
         * o.transform.position = new Vector3(0f, r, 0f);
         * o.transform.localScale = new Vector3(0.5f, 0.5f, 1.0f);
         * mRemotePeer = uid; */
    }
Exemple #8
0
    void OnUserJoinedHandler(uint uid, int elapsed)
    {
        Debug.Log("onUserJoined: uid = " + uid + " elapsed = " + elapsed);

        // find a game object to render video stream from 'uid'
        GameObject go = GameObject.Find(uid.ToString());

        if (go != null)
        {
            return;
        }

        // create a GameObject and assign to this new user
        VideoSurface videoSurface = makeImageSurface(uid.ToString());

        if (videoSurface != null)
        {
            // configure videoSurface
            videoSurface.SetForUser(uid);
            videoSurface.SetEnable(true);
            videoSurface.SetVideoSurfaceType(AgoraVideoSurfaceType.RawImage);
            videoSurface.SetGameFps(30);
        }

        usersInChannel++;
    }
Exemple #9
0
    // When a remote user joined, this delegate will be called. Typically
    // create a GameObject to render video on it
    private void onUserJoined(uint uid, int elapsed)
    {
        Debug.LogError("onUserJoined: uid = " + uid);
        // this is called in main thread

        // find a game object to render video stream from 'uid'
        GameObject go = GameObject.Find(uid.ToString());

        if (!ReferenceEquals(go, null))
        {
            return; // reuse
        }

        // create a GameObject and assigne to this new user
        go = GameObject.CreatePrimitive(PrimitiveType.Cube);
        if (!ReferenceEquals(go, null))
        {
            go.name = uid.ToString();

            // configure videoSurface
            VideoSurface o = go.AddComponent <VideoSurface>();
            o.SetForUser(uid);
            o.SetEnable(true);
            o.transform.Rotate(-90.0f, 0.0f, 0.0f);
            o.transform.position   = getNextCubePosition();
            o.transform.localScale = Vector3.one;
        }
        OnEnable();
    }
Exemple #10
0
    protected override void SetupUI()
    {
        base.SetupUI();
        Button titleBtn = GameObject.Find("TitleButton").GetComponent <Button>();

        titleBtn.onClick.AddListener(() => { Application.OpenURL(DOCUMENTATION_URL); });

        Button startButton = GameObject.Find("StartButton").GetComponent <Button>();

        startButton.onClick.AddListener(() => { HandleStartButtonClick(startButton); });

        host1 = GameObject.Find("Host1").AddComponent <VideoSurface>();
        host2 = GameObject.Find("Host2").AddComponent <VideoSurface>();
        host1.SetEnable(false);
        host2.SetEnable(false);

        GameObject loggerObj = GameObject.Find("LoggerText");

        if (loggerObj != null)
        {
            Text text = loggerObj.GetComponent <Text>();
            if (text != null)
            {
                logger = new Logger(text);
                logger.Clear();
            }
        }
    }
Exemple #11
0
    // When a remote user joined, this delegate will be called. Typically
    // create a GameObject to render video on it
    private void onUserJoined(uint uid, int elapsed)
    {
        Debug.Log("onUserJoined: uid = " + uid);
        // this is called in main thread

        // find a game object to render video stream from 'uid'
        GameObject go = GameObject.Find(uid.ToString());

        if (!ReferenceEquals(go, null))
        {
            return; // reuse
        }

        numUsers++;
        // create a GameObject and assigne to this new user
        go = GameObject.CreatePrimitive(PrimitiveType.Plane);
        if (!ReferenceEquals(go, null))
        {
            go.name = uid.ToString();

            // configure videoSurface
            VideoSurface o = go.AddComponent <VideoSurface>();
            o.SetForUser(uid);
            //o.mAdjustTransfrom += onTransformDelegate; ///
            o.SetEnable(true);
            o.transform.Rotate(-90.0f, 180.0f, 0.0f);
            //float r = Random.Range (-5.0f, 5.0f); ///
            var videoQuadPos = GameObject.Find("VideoSpawn").transform.position;
            o.transform.position   = videoQuadPos + new Vector3(0, 0, 0);     //y wie x
            o.transform.localScale = new Vector3(0.50f, (0.28125f), (0.50f)); //ohen die 5en  0.09475f  0.5f  0.094924f
        }

        // mRemotePeer = uid;
    }
    private void onUserJoined(uint uid, int elapsed)
    {
        Debug.Log("onUserJoined: uid = " + uid);
        // this is called in main thread

        // find a game object to render video stream from 'uid'
        GameObject go = GameObject.Find(uid.ToString());

        if (!ReferenceEquals(go, null))
        {
            return;             // reuse
        }

        // create a GameObject and assigne to this new user
        go = GameObject.CreatePrimitive(PrimitiveType.Plane);
        if (!ReferenceEquals(go, null))
        {
            go.name = uid.ToString();

            // configure videoSurface
            VideoSurface o = go.AddComponent <VideoSurface> ();
            o.SetForUser(uid);
            o.mAdjustTransfrom += onTransformDelegate;
            o.SetEnable(true);
            o.transform.Rotate(-90.0f, 0.0f, 0.0f);
            float r = Random.Range(-5.0f, 5.0f);
            o.transform.position   = new Vector3(0f, r, 0f);
            o.transform.localScale = new Vector3(0.5f, 0.5f, 1.0f);
        }

        mRemotePeer = uid;
    }
Exemple #13
0
 protected override void OnJoinChannelSuccess(string channelName, uint uid, int elapsed)
 {
     base.OnJoinChannelSuccess(channelName, uid, elapsed);
     host1.SetEnable(true);
     hostCount++;
     MyUID = uid;
 }
    // When a remote user joined, this delegate will be called. Typically
    // create a GameObject to render video on it
    private void onUserJoined(uint uid, int elapsed)
    {
        Debug.Log("onUserJoined: uid = " + uid + " elapsed = " + elapsed);
        // this is called in main thread

        // find a game object to render video stream from 'uid'
        GameObject go = GameObject.Find(uid.ToString());

        if (!ReferenceEquals(go, null))
        {
            return; // reuse
        }

        // create a GameObject and assign to this new user
        VideoSurface videoSurface = makeImageSurface(uid.ToString());

        if (!ReferenceEquals(videoSurface, null))
        {
            // configure videoSurface
            videoSurface.SetForUser(uid);
            videoSurface.SetEnable(true);
            videoSurface.SetVideoSurfaceType(AgoraVideoSurfaceType.RawImage);
            videoSurface.SetGameFps(30);
        }
    }
Exemple #15
0
 private void Start()
 {
     if (SceneManager.GetActiveScene().name.Equals("SimpleCamera"))
     {
         TestHome.GetInstance.JustOn();
         surface.SetEnable(true);
     }
 }
Exemple #16
0
    // accessing GameObject in Scnene1
    // set video transform delegate for statically created GameObject
    public void onSceneHelloVideoLoaded()
    {
        Debug.Log("onSceneHelloVideoLoaded_________________________________");
        GameObject   go = RecallController.GetInstanse.GetLocal;
        VideoSurface o  = go.AddComponent <VideoSurface> ();

        o.SetEnable(true);
    }
Exemple #17
0
    // accessing GameObject in Scnene1
    // set video transform delegate for statically created GameObject
    public void onSceneHelloVideoLoaded()
    {
        //Debug.Log("onSceneHelloVideoLoaded");
        GameObject   go = DisplayCamManager.GetInstance.GetLocal;
        VideoSurface o  = go.AddComponent <VideoSurface> ();

        o.SetEnable(true);
        switchCamera();
    }
    private void OnUserJoined(uint uid, int elapsed)
    {
        // Debug.Log("New User has joined the channel");
        videoSurface.SetActive(true);
        videoSurface.name = uid.ToString();
        VideoSurface o = videoSurface.GetComponent <VideoSurface>();

        o.SetForUser(uid);
        o.SetEnable(true);
        mRemotePeer = uid;
    }
Exemple #19
0
    private void onJoinChannelSuccess(string channelName, uint uid, int elapsed)
    {
        Debug.Log("JoinChannelSuccessHandler: uid = " + uid);
        GameObject textVersionGameObject = GameObject.Find("VersionText");

        textVersionGameObject.GetComponent <Text> ().text = "Version : " + getSdkVersion();



        GameObject go1, go2, go3, go4;

        GameObject go = GameObject.Find(uid.ToString());

        if (!ReferenceEquals(go, null))
        {
            return;             // reuse
        }


        go1 = GameObject.Find("Cylinder");
        go2 = GameObject.Find("Cylinder2");
        go3 = GameObject.Find("Cylinder3");
        go4 = GameObject.Find("Cylinder4");

        go2.GetComponent <Renderer>().enabled = false;
        go3.GetComponent <Renderer>().enabled = false;
        go4.GetComponent <Renderer>().enabled = false;


        GameObject go1_cp = new GameObject();

        go1_cp = Instantiate(go1);

        go1_cp.GetComponent <Renderer>().enabled = true;

        go1.name = "C_" + uid.ToString();

        go1_cp.name = uid.ToString();
        anf         = uid;
        go          = go1_cp;

        if (!ReferenceEquals(go, null))
        {
            go.name = uid.ToString();

            // configure videoSurface
            VideoSurface o = go.GetComponent <VideoSurface> ();
            o.SetForUser(uid);
            o.SetEnable(true);
        }
    }
    private void OnUserJoined(uint uid, int elapsed)
    {
        print("user joined");
        remoteVideo.name = uid.ToString();
        VideoSurface videoSurface = makeImageSurface(uid.ToString());

        if (!ReferenceEquals(videoSurface, null))
        {
            videoSurface.SetForUser(uid);
            videoSurface.SetEnable(true);
            videoSurface.SetVideoSurfaceType(AgoraVideoSurfaceType.RawImage);
            videoSurface.SetGameFps(30);
        }
    }
Exemple #21
0
    // Start is called before the first frame update
    void Start()
    {
        VideoSurface vo = GetComponent <VideoSurface>();

        if (ReferenceEquals(vo, null))
        {
            Debug.Log("cant find VO");
        }
        else
        {
            Debug.Log("VO found and initialized");
            vo.SetForUser(0);
            vo.SetEnable(true);
        }
    }
Exemple #22
0
    void CreateNewUserVideoFrame(uint newUserUid)
    {
        if (photonView.isMine)
        {
            userCount++;

            GameObject newUserVideo = Instantiate(videoSurfacePrefab, transform.GetChild(1));

            newUserVideo.GetComponent <RectTransform>().anchoredPosition += Vector2.right * 120 * userCount;

            VideoSurface videoControls = newUserVideo.GetComponent <VideoSurface>();
            videoControls.SetForUser(newUserUid);
            videoControls.SetVideoSurfaceType(AgoraVideoSurfaceType.RawImage);
            videoControls.SetEnable(true);
        }
    }
Exemple #23
0
    // When a remote user joined, this delegate will be called. Typically
    // create a GameObject to render video on itRecallController.GetInstanse
    private void onUserJoined(uint uid, int elapsed)
    {
        success = true;
        Debug.Log("agora_:" + "onUserJoined: uid = " + uid);
        // this is called in main thread
        RecallController.GetInstanse.StopWaytingDialog();
        // find a game object to render video stream from 'uid'
        GameObject go = RecallController.GetInstanse.GetRemote;

        go.SetActive(true);
        VideoSurface o = go.AddComponent <VideoSurface> ();

        o.SetForUser(uid);
        o.SetEnable(true);
        mRemotePeer = uid;
    }
Exemple #24
0
    private void onUserJoined(uint uid, int elapsed)
    {
        Debug.Log("onUserJoined");
        GameObject go = GameObject.Find("other");
        // go.name = uid.ToString();

        VideoSurface o = go.AddComponent <VideoSurface>();

        o.SetForUser(uid);
        o.SetEnable(true);
        // o.transform.Rotate(-90, 0, 0);

        //o.transform.localScale = new Vector3(1, 1, 1);

        mRemotePeer = uid;
    }
        void OnUserJoinedHandler(uint uid, int elapsed)
        {
            logger.UpdateLog(string.Format("OnUserJoined uid: ${0} elapsed: ${1}", uid, elapsed));
            GameObject go = Instantiate(userPrefab);

            RemoteUserObject[uid] = go;
            go.transform.SetParent(rootSpace);
            go.transform.localScale    = Vector3.one;
            go.transform.localPosition = new Vector3(userCount * 2, 0, 0);

            VideoSurface v = go.AddComponent <VideoSurface>();

            v.SetForUser(uid);
            v.SetEnable(true);
            v.SetVideoSurfaceType(AgoraVideoSurfaceType.Renderer);
            userCount++;
        }
    void VideoImageClicked(string name)
    {
        if (bigPicTemp != null)
        {
            if (bigPicTemp.name == name)
            {
                removeObserver(uint.Parse(name));
                AddObserver(uint.Parse(name));
            }
            RemoveBig();
        }
        else
        {
            GameObject go = null;
            for (int i = 0; i < allObserver.Count; i++)
            {
                if (allObserver[i].name == name)
                {
                    go = allObserver[i];
                    break;
                }
                Debug.Log(name);
            }
            if (go != null)
            {
                VideoSurface video1 = go.GetComponent <VideoSurface>();
                DestroyImmediate(video1);
            }

            bigPicTemp                  = Instantiate(bigPic);
            bigPicTemp.name             = name;
            bigPicTemp.transform.parent = bkaVideoParent;
            bigPicTemp.GetComponent <RectTransform>().SetAsFirstSibling();
            bigPicTemp.transform.localScale = new Vector3(1, -1, 1);
            bigPicTemp.SetActive(true);
            VideoSurface videoSurface = bigPicTemp.AddComponent <VideoSurface>();
            videoSurface.resize = true;
            videoSurface.expert = isExpert;
            // configure videoSurface
            videoSurface.SetForUser(uint.Parse(name));
            videoSurface.SetEnable(true);
            videoSurface.SetVideoSurfaceType(AgoraVideoSurfaceType.RawImage);
            videoSurface.SetGameFps(25);
        }
    }
Exemple #27
0
    // When a remote user joined, this delegate will be called. Typically
    // create a GameObject to render video on it
    private void onUserJoined(uint uid, int elapsed)
    {
        success = true;
        //Debug.Log ("agora_:"+"onUserJoined: uid = " + uid);
        // this is called in main thread
        // find a game object to render video stream from 'uid'
        GameObject go = DisplayCamManager.GetInstance.GetRemote;

        //Debug.Log("agora_:" + "onUserJoined: GEted GO ");
        go.SetActive(true);

        VideoSurface o = go.AddComponent <VideoSurface> ();

        //Debug.Log("agora_:" + "onUserJoined:Video Surface Added");
        o.SetForUser(uid);
        o.SetEnable(true);
        mRemotePeer = uid;
        //Debug.Log("agora_:" + "onUserJoined:Video Surface set video");
    }
Exemple #28
0
    private void makeVideoView(uint uid)
    {
        GameObject go = GameObject.Find(uid.ToString());

        if (!ReferenceEquals(go, null))
        {
            return; // reuse
        }

        // create a GameObject and assign to this new user
        VideoSurface videoSurface = makeImageSurface(uid.ToString());

        if (!ReferenceEquals(videoSurface, null))
        {
            // configure videoSurface
            videoSurface.SetForUser(uid);
            videoSurface.SetEnable(true);
            videoSurface.SetVideoSurfaceType(AgoraVideoSurfaceType.RawImage);
            videoSurface.SetGameFps(30);
        }
    }
Exemple #29
0
    private void makeVideoView(string channelId, uint uid)
    {
        string     objName = channelId + "_" + uid.ToString();
        GameObject go      = GameObject.Find(objName);

        if (!ReferenceEquals(go, null))
        {
            return; // reuse
        }

        // create a GameObject and assign to this new user
        VideoSurface videoSurface = makeImageSurface(objName);

        if (!ReferenceEquals(videoSurface, null))
        {
            // configure videoSurface
            videoSurface.SetForMultiChannelUser(channelId, uid);
            videoSurface.SetEnable(true);
            videoSurface.SetVideoSurfaceType(AgoraVideoSurfaceType.RawImage);
            videoSurface.SetGameFps(30);
        }
    }
Exemple #30
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);
        });
    }