Esempio n. 1
0
        private async void StartRecording(Callback callback)
        {
            bool   result        = true;
            string message       = null;
            string fileExtension = ".3gp";

            int    counter       = 0;
            string audioFileName = StorageUtility.UpdateFilename(audioDefaultFileName, counter) + fileExtension;
            bool   fileExists    = await StorageUtility.IsFileExistAsync(audioFileName, localFolderName);

            while (fileExists)
            {
                counter++;
                audioFileName = StorageUtility.UpdateFilename(audioFileName, counter) + fileExtension;
                fileExists    = await StorageUtility.IsFileExistAsync(audioFileName, localFolderName);
            }

            string currentFilePath = StorageUtility.GetAppLocalPath() + "/" + localFolderName + "/" + audioFileName;

            result = result && await StorageUtility.CreateEmptyFileInFolder(localFolderName, audioFileName);

            result = result && _recorder.StartRecording(currentFilePath, out message);

            callback?.Invoke(result, message, currentFilePath);
        }