private void HandleEndRecord(ApiRequest request)
{
#if __MonoCS__
#else
if (Recorder.RecordingState != RecordingState.Recording)
{
//usually, this is a result of us getting the "end" before we actually started, because it was too quick
if(TestForTooShortAndSendFailIfSo(request))
{
_startRecordingTimer.Enabled = false;//we don't want it firing in a few milliseconds from now
return;
}
//but this would handle it if there was some other reason
request.Failed("Got endRecording, but was not recording");
return;
}
try
{
Debug.WriteLine("Stop recording");
Recorder.Stopped += Recorder_Stopped;
//note, this doesn't actually stop... more like... starts the stopping. It does mark the time
//we requested to stop. A few seconds later (2, looking at the library code today), it will
//actually close the file and raise the Stopped event
Recorder.Stop();
request.Succeeded();
//ReportSuccessfulRecordingAnalytics();
}
catch (Exception)
{
//swallow it. One reason (based on HearThis comment) is that they didn't hold it down long enough, we detect this below.
}
TestForTooShortAndSendFailIfSo(request);
#endif
}