コード例 #1
0
        public static VideoCapturer Create(CaptureSource source)
        {
            VideoCapturer cap;

            switch (source)
            {
            case CaptureSource.CameraBack:
                cap = new VideoCapturer(source);
                break;

            case CaptureSource.CameraFront:
                cap = new VideoCapturer(source);
                break;

            case CaptureSource.Screen:
                cap = new VideoCapturer(source);
                break;

            case CaptureSource.RenderTexture:
                throw new NotImplementedException("CaptureSource.RenderTexture is not yet supported");

            default:
                throw new NotSupportedException("CaptureSource not valid");
            }
            return(cap);
        }
コード例 #2
0
 void Start()
 {
     capturer = VideoCapturer.Create(source);
     capturer.Callback.OnVideoCapturerStarted += OnVideoCapturerStarted;
     capturer.Callback.OnVideoCapturerStopped += OnVideoCapturerStopped;
     capturer.Callback.OnVideoCapturerError   += OnVideoCapturerError;
     capturer.Callback.OnTexture += OnTexture;
     if (captureOnStart)
     {
         capturer.StartCapture();
     }
 }