基本信息
源码名称:unity3d 引擎 C# 双端开发实时音视频精简项目源码,client + sever 总共只用4个代码文件
源码大小:4.33M
文件格式:.rar
开发语言:C#
更新时间:2018-11-22
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 5 元 
   源码介绍
unity3d 引擎 C# 双端开发实时音视频精简项目源码,client sever 总共只用4个代码文件

  yield return Application.RequestUserAuthorization(UserAuthorization.WebCam);//请求授权使用Web播放器中的摄像头或麦克风 并 请求许可使用任何附在计算机上的视频输入源。。
        if (Application.HasUserAuthorization(UserAuthorization.WebCam))//检查用户是否已授权使用Web播放器中的摄像头或麦克风。
        {
            //可以通过下面的这个数组的索引来选择调用手机上的前置或者后置摄像头,另外这个可以自动对焦
            WebCamDevice[] devices = WebCamTexture.devices;//Return a list of available devices.
            if (devices.Length <= whichOne)
            {
                m_cameraName = devices[0].name;
            }
            else
            {
                m_cameraName = devices[whichOne].name;
                if (whichOne > 0)
                {
                    /* Quaternion temp = m_uiCameraPlane.transform.localRotation;
                     temp.eulerAngles = new Vector3(0, 0, 90);
                     m_uiCameraPlane.transform.localRotation = temp;*/
                }
            }
            m_cameraTex = new WebCamTexture(m_cameraName, Screen.width, Screen.height, 30);
            m_cameraTex.anisoLevel = 9;//纹理的各向异性滤波水平
            float heightRate = Screen.height / m_cameraTex.height;
            float widthRate = Screen.width / m_cameraTex.width;
            //Debug.Log(heightRate.ToString());
            //Debug.Log(widthRate.ToString());
            m_zoomRate = heightRate > widthRate ? heightRate : widthRate;
            if (m_zoomRate > 2)
            {
                m_zoomRate = 2;
            }
            m_cameraTex.Play();
            if (isfirststar)
            {
                texture = new Texture2D(m_cameraTex.width, m_cameraTex.height);
                isfirststar = false;
            }

        }