Exemple #1
0
        public static void CreateAsync(bool showHolograms, OnVideoCaptureResourceCreatedCallback onCreatedCallback)
        {
            NRVideoCapture capture = new NRVideoCapture();

            capture.m_CaptureContext = FrameCaptureContextFactory.Create();
            onCreatedCallback?.Invoke(capture);
        }
Exemple #2
0
        private static IntPtr Instantiate_Internal(bool showHolograms, OnVideoCaptureResourceCreatedCallback onCreatedCallback)
        {
            IntPtr ptr;

            INTERNAL_CALL_Instantiate_Internal(showHolograms, onCreatedCallback, out ptr);
            return(ptr);
        }
 public static void CreateAsync(bool showHolograms, OnVideoCaptureResourceCreatedCallback onCreatedCallback)
 {
     if (onCreatedCallback == null)
     {
         throw new ArgumentNullException("onCreatedCallback");
     }
     Instantiate_Internal(showHolograms, onCreatedCallback);
 }
Exemple #4
0
 public static void CreateAsync(bool showHolograms, OnVideoCaptureResourceCreatedCallback onCreatedCallback)
 {
     if (onCreatedCallback == null)
     {
         throw new ArgumentNullException("onCreatedCallback");
     }
     Instantiate_Internal(showHolograms, onCreatedCallback);
 }
Exemple #5
0
 public void GetVideoCaptureAsync(OnVideoCaptureResourceCreatedCallback onVideoCaptureAvailable)
 {
     if (VideoCapture == null)
     {
         VideoCaptureCreated += onVideoCaptureAvailable;
     }
     else
     {
         onVideoCaptureAvailable?.Invoke(VideoCapture);
     }
 }
 private static void InvokeOnCreatedVideoCaptureResourceDelegate(OnVideoCaptureResourceCreatedCallback callback, IntPtr nativePtr)
 {
     if (nativePtr == IntPtr.Zero)
     {
         callback(null);
     }
     else
     {
         callback(new VideoCapture(nativePtr));
     }
 }
        public static void CreateAsync(bool showHolograms, OnVideoCaptureResourceCreatedCallback onCreatedCallback)
        {
            NRVideoCapture capture = new NRVideoCapture();

            capture.m_RecordBehaviour = NRRecordBehaviour.Create(() =>
            {
                if (onCreatedCallback != null)
                {
                    onCreatedCallback(capture);
                }
            });
        }
        //-----------------------------------------------------------------
        public static void CreateAsync(bool showHolograms, OnVideoCaptureResourceCreatedCallback onCreatedCallback)
        {
            if (onCreatedCallback == null)
            {
                throw new ArgumentNullException("onCreatedCallback");
            }

            // NOTE: This option no longer works in XR SDK and (as specified in the Documentation) the parameter is ignored.
            showHolograms = false;

            Instantiate_Internal(showHolograms, onCreatedCallback);
        }
    public void GetVideoCaptureAsync(OnVideoCaptureResourceCreatedCallback onVideoCaptureAvailable)
    {
        if (onVideoCaptureAvailable == null)
        {
            Debug.LogError("You must supply the onVideoCaptureAvailable delegate.");
        }

        if (videoCapture == null)
        {
            VideoCaptureCreated += onVideoCaptureAvailable;
        }
        else
        {
            onVideoCaptureAvailable(videoCapture);
        }
    }
Exemple #10
0
    public void GetVideoCaptureAsync(OnVideoCaptureResourceCreatedCallback onVideoCaptureAvailable)
    {
        if (onVideoCaptureAvailable == null)
        {
            Debug.LogError("You must supply the onVideoCaptureAvailable delegate.");
        }

        if (VideoCaptureCreated == null)
        {
            VideoCaptureCreated += onVideoCaptureAvailable;
        }

        if (videoCapture == null)
        {   // this will fire the onVideoCaptureAvailable
            // once the video capture is created
            CreateVideoCaptureInstance();
        }
    }
        /// <summary>
        /// Asynchronously creates an instance of a VideoCapture object that can be used to stream video frames from the camera to memory.
        /// If the instance failed to be created, the instance returned will be null. Also, holograms will not appear in the video.
        /// </summary>
        /// <param name="onCreatedCallback">This callback will be invoked when the VideoCapture instance is created and ready to be used.</param>
        public static async void CreateAync(OnVideoCaptureResourceCreatedCallback onCreatedCallback, bool sharedStream = false)
        {
            var allFrameSourceGroups = await MediaFrameSourceGroup.FindAllAsync();                                              //Returns IReadOnlyList<MediaFrameSourceGroup>

            var candidateFrameSourceGroups = allFrameSourceGroups.Where(group => group.SourceInfos.Any(IsColorVideo));          //Returns IEnumerable<MediaFrameSourceGroup>
            var selectedFrameSourceGroup   = candidateFrameSourceGroups.FirstOrDefault();                                       //Returns a single MediaFrameSourceGroup

            if (selectedFrameSourceGroup == null)
            {
                onCreatedCallback?.Invoke(null);
                return;
            }

            var selectedFrameSourceInfo = selectedFrameSourceGroup.SourceInfos.FirstOrDefault(); //Returns a MediaFrameSourceInfo


            if (selectedFrameSourceInfo == null)
            {
                onCreatedCallback?.Invoke(null);
                return;
            }

            var devices = await DeviceInformation.FindAllAsync(DeviceClass.VideoCapture);   //Returns DeviceCollection

            var deviceInformation = devices.FirstOrDefault();                               //Returns a single DeviceInformation

            if (deviceInformation == null)
            {
                onCreatedCallback?.Invoke(null);
                return;
            }

            var videoCapture = new VideoCapture(selectedFrameSourceGroup, selectedFrameSourceInfo, deviceInformation);

            videoCapture._sharedStream = sharedStream;
            await videoCapture.CreateMediaCaptureAsync();

            onCreatedCallback?.Invoke(videoCapture);
        }
 private extern static void Instantiate_Internal(bool showHolograms, OnVideoCaptureResourceCreatedCallback onCreatedCallback);
 private static IntPtr Instantiate_Internal(bool showHolograms, OnVideoCaptureResourceCreatedCallback onCreatedCallback)
 {
     IntPtr ptr;
     INTERNAL_CALL_Instantiate_Internal(showHolograms, onCreatedCallback, out ptr);
     return ptr;
 }
Exemple #14
0
 private static extern void INTERNAL_CALL_Instantiate_Internal(bool showHolograms, OnVideoCaptureResourceCreatedCallback onCreatedCallback, out IntPtr value);
Exemple #15
0
 public static void CreateAync(OnVideoCaptureResourceCreatedCallback onCreatedCallback)
 {
     throw new NotImplementedException();
 }
 public extern static void CreateAsync(bool showHolograms, [NotNull] OnVideoCaptureResourceCreatedCallback onCreatedCallback);
Exemple #17
0
 public static void CreateAync(OnVideoCaptureResourceCreatedCallback onCreatedCallback, bool sharedStream = false)
 {
     throw new NotImplementedException();
 }
 private static extern void INTERNAL_CALL_Instantiate_Internal(bool showHolograms, OnVideoCaptureResourceCreatedCallback onCreatedCallback, out IntPtr value);
 private static void InvokeOnCreatedVideoCaptureResourceDelegate(OnVideoCaptureResourceCreatedCallback callback, IntPtr nativePtr)
 {
     if (nativePtr == IntPtr.Zero)
     {
         callback(null);
     }
     else
     {
         callback(new VideoCapture(nativePtr));
     }
 }
 public static void CreateAsync(OnVideoCaptureResourceCreatedCallback onCreatedCallback, SourceKind[] sourceKinds, SourceKind readerSourceKind)
 {
     throw new NotImplementedException();
 }