/// <summary> /// Returns a new VideoFrameSample as soon as the next one is available. /// This method is preferable to listening to the FrameSampleAcquired event /// in circumstances where most or all frames are not needed. For instance, if /// you were planning on sending frames to a remote image recognition service twice per second, /// you may consider using this method rather than ignoring most of the event dispatches from FrameSampleAcquired. /// This will avoid the overhead of acquiring and disposing of unused frames. /// /// If, for whatever reason, a frame reference cannot be obtained, it is possible that the callback will return a null sample. /// </summary> /// <param name="onFrameSampleAcquired"></param> public void RequestNextFrameSample(FrameSampleAcquiredCallback onFrameSampleAcquired) { if (onFrameSampleAcquired == null) { throw new ArgumentNullException("onFrameSampleAcquired"); } if (IsStreaming == false) { throw new Exception("You cannot request a frame sample until the video mode is started."); } TypedEventHandler <MediaFrameReader, MediaFrameArrivedEventArgs> handler = null; handler = (MediaFrameReader sender, MediaFrameArrivedEventArgs args) => { using (var frameReference = _frameReader.TryAcquireLatestFrame()) //frame: MediaFrameReference { if (frameReference != null) { onFrameSampleAcquired.Invoke(new VideoCaptureSample(frameReference, worldOrigin)); } else { onFrameSampleAcquired.Invoke(null); } } _frameReader.FrameArrived -= handler; }; _frameReader.FrameArrived += handler; }
public void RequestNextFrameSample(FrameSampleAcquiredCallback onFrameSampleAcquired) { throw new NotImplementedException(); }