Example #1
0
        //called from native code
        public override StringVector GetVideoDevices()
        {
            StringVector vector = new StringVector();

            try
            {
                foreach (var v in WebCamTexture.devices)
                {
                    if (v.isFrontFacing)
                    {
                        string deviceName = sDevicePrefix + v.name;
                        vector.Add(deviceName);
                    }
                }
                foreach (var v in WebCamTexture.devices)
                {
                    if (v.isFrontFacing == false)
                    {
                        string deviceName = sDevicePrefix + v.name;
                        vector.Add(deviceName);
                    }
                }
                if (sTestDeviceActive)
                {
                    vector.Add(sTestDeviceName);
                }
            }
            catch (Exception e)
            {
                SLog.LogException(e, LOGTAG);
            }
            return(vector);
        }
Example #2
0
 //called from native code
 public override HLCustomVideoCapturer Create(string deviceName)
 {
     try
     {
         if (sTestDeviceActive && deviceName == sTestDeviceName)
         {
             var v = new UnityVideoCapturer();
             lock (mActiveCapturers)
             {
                 mActiveCapturers.Add(v);
             }
             return(v);
         }
         foreach (var device in WebCamTexture.devices)
         {
             if (deviceName == (sDevicePrefix + device.name))
             {
                 Debug.Log("Creating new unity video caputurer: " + device.name);
                 var v = new UnityVideoCapturer(device.name);
                 if (v != null)
                 {
                     lock (mActiveCapturers)
                     {
                         mActiveCapturers.Add(v);
                     }
                     return(v);
                 }
             }
         }
     }
     catch (Exception e)
     {
         SLog.LogException(e, LOGTAG);
     }
     return(null);
 }