Search code examples
c#windowsvideo-capture

Windows Runtime API: MediaCapture how to limit recording file size


With Windows.Media.Capture.MediaCapture, can we specify a size limit so that this event(RecordLimitationExceededEventHandler) is fired and recording is stopped?

If not, what is the proper way to monitor file size.

Thanks!


Solution

  • From MSDN:

    If an app receives a RecordLimitationExceeded event, it is expected to finalize the file it is recording. If it does not finalize, the capture engine will stop sending samples to the file that the app was recording to.

    In Windows 8, the current record limit is three hours.

    So the platform will raise this event for you.

    If you're interested in limiting the file size, there's a good sample on the FileSystemWatcher MSDN page for how to monitor changes to a file. Look for the Changed event, and examine the ChangeType argument.