public void Stop() { if (_recorder != null) { _recorder.Stop(); ClearTimer(); } }
public static void StopBackgroundMode() { if (audioRecorder.Recording) { audioRecorder.Stop(); } if (File.Exists(Manager.AudioFile)) { File.Delete(Manager.AudioFile); } }
public byte[] StopRecord() { if (_recorder == null || !_isRecord) { return(default(byte[])); } _recorder.Stop(); _isRecord = false; var bytes = default(byte[]); using (var streamReader = new StreamReader(_path)) { using (var memstream = new MemoryStream()) { streamReader.BaseStream.CopyTo(memstream); bytes = memstream.ToArray(); } } File.Delete(_path); return(bytes); }
public void Stop() { if (recorder != null) { recorder.Stop(); } }
public string StopRecord() { recorder.Stop(); recorder.Dispose(); recorder = null; return(sFileName); }
public static void StopBackgroundMode() { BackgroundTypes mode = (BackgroundTypes)(int)NSUserDefaults.StandardUserDefaults.IntForKey(UserDefaultsKeys.BackgroundModeType); switch (mode) { case BackgroundTypes.Microphone: if (audioRecorder != null && audioRecorder.Recording) { audioRecorder.Stop(); } if (File.Exists(Manager.AudioFile)) { File.Delete(Manager.AudioFile); } break; case BackgroundTypes.Music: if (audioObserver != null) { NSNotificationCenter.DefaultCenter.RemoveObserver(audioObserver); audioObserver = null; audioPlayer.Stop(); } break; } backgroundRunning = false; }
protected override bool NativeStopRecording() { AudioRecorder?.Stop(); AudioRecorder = null; return(true); }
partial void RecButtonPressed(NSObject sender) { Console.WriteLine("Pressed button"); if (!recording) { Console.WriteLine("Starting recording"); ImageService.Instance.LoadCompiledResource("StopButton").Into(RecButton); recorder.Record(); recording = true; clockThread = new Thread(UpdateClock); clockThread.Start(); } else { Console.WriteLine("stopping recording"); recorder.Stop(); ImageService.Instance.LoadCompiledResource("RecordButton").IntoAsync(RecButton); recording = false; clockThread.Join(); Console.WriteLine("Saved audio to: " + filePath); innerPath = Path.Combine(Directory.GetParent(filePath).Name, Path.GetFileName(filePath)); if (createMode) { PerformSegue("UnwindToCreateListenAudio", this); } else { ReturnWithData(innerPath); } } }
public void Stop() { _cts?.Cancel(); _recorder.Stop(); byte[] audioBytes = null; if (_options.StreamFormat == AudioRecordOptions.Format.Wave) { audioBytes = File.ReadAllBytes(_audioFilePath); } else if (_options.StreamFormat == AudioRecordOptions.Format.Flac) { // encode audio into flac using (var fr = File.OpenRead(_audioFilePath)) { using (var ms = new MemoryStream()) { using (var what = new WaveOverFlacStream(ms, WaveOverFlacStreamMode.Encode, true)) { fr.CopyTo(what); } ms.Flush(); ms.Seek(0, SeekOrigin.Begin); audioBytes = ms.ToArray(); } } } File.Delete(_audioFilePath); _tcs.TrySetResult(new AudioRecordResult(audioBytes)); }
public Task <AudioRecording> StopAsync() { recorder.Stop(); var recording = new AudioRecording(recorder.Url.Path); return(Task.FromResult(recording)); }
public void StopRecording() { if (recorder == null) { throw new Exception("Start recording first."); } recorder.Stop(); }
public static void StopRecording(Action finishedRecording) { _recorder.Stop(); _recorder.FinishedRecording += delegate { _recorder.Dispose(); finishedRecording(); }; }
/// <summary> /// Stops recording and sets session back to playback mode. /// </summary> public void StopRecording() { if (recorder != null) { Console.WriteLine("stopped recording"); recorder.Stop(); AVAudioSession.SharedInstance().SetCategory(AVAudioSession.CategoryPlayback, out NSError error); } }
public void StopRecording() { if (recorder == null) { throw new Exception("You must first start recording."); } recorder.Stop(); }
public void StopRecording() { if (_recorder == null) { return; } _recorder.Stop(); _recorder = null; }
public Recording StopRecording() { _recorder.Stop(); Recording r = new Recording(); r.CreationTime = DateTime.Now; r.FileName = _audioFileName; r.FilePath = _audioFilePath; return(r); }
public string StopRecording() { if (_recorder == null) { throw new Exception("You must first start recording."); } _recorder.Stop(); return(_currentRecordUrl.Path); }
partial void StopRecording(UIButton sender) { if (recorder != null) { recorder.Stop(); stopwatch?.Stop(); Status = Status.Recorded; } }
public void RecordStop() { System.Diagnostics.Debug.WriteLine("*** AudioService.RecordStop - Preparing to end recording"); if (!_Recorder.Recording) { return; } System.Diagnostics.Debug.WriteLine("*** AudioService.RecordStop - Stopping"); _Recorder.Stop(); }
/// /// Name AudioRecordStop /// /// <summary> Stop the recoreder if it is in recording. /// </summary> /// public void AudioRecordStop() { try { recorder?.Stop(); } catch (Exception ex) { LogTracking.LogTrace(ex.ToString()); } }
void OnStopRecording(object sender, EventArgs e) { recorder.Stop(); stopwatch.Stop(); LengthOfRecordingLabel.Text = string.Format("{0:hh\\:mm\\:ss}", stopwatch.Elapsed); RecordingStatusLabel.Text = ""; StartRecordingButton.Enabled = true; StopRecordingButton.Enabled = false; PlayRecordedSoundButton.Enabled = true; }
/// <summary> /// Views the will disappear. /// </summary> /// <param name="animated">If set to <c>true</c> animated.</param> public override void ViewWillDisappear(Boolean animated) { base.ViewDidDisappear(animated); // if (m_audioPlayer != null) { m_audioPlayer.Delegate = null; m_audioPlayer.Stop(); m_audioPlayer = null; } if (m_audioRecorder != null) { m_audioRecorder.Delegate = null; m_audioRecorder.Stop(); m_audioRecorder = null; } StopUpdatingMeter(); }
private static void DoneRecording() { audioRecorder.Stop(); string path = Path.GetFileName(audioRecorder.Url.AbsoluteString); var parameters = new Dictionary <string, string>() { { "AudioId", path } }; iApp.Navigate(callback, parameters); }
public void StopRecording() { try { if (recorder != null) { recorder.Stop(); recorder.Dispose(); } } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public Stream EndCaptureAudio() { if (_audioRecorder == null) { return(null); } _audioRecorder.Stop(); var path = _audioRecorder.Url.Path; return(new DelegateStream( () => File.OpenRead(path), () => File.Delete(path))); }
public Task <FileData> PlatformStopAsync() { if (_recorder == null) { return(Task.FromResult(default(FileData))); } _recorder.Stop(); _recorder.Dispose(); _recorder = null; AVAudioSession.SharedInstance().SetActive(false); FileInfo fi = new FileInfo(_audioFilePath); return(Task.FromResult(new FileData(_audioFilePath, fi.Name, (ulong)fi.Length))); }
public void StopRecord() { audioRecorder.Stop(); bt_Record.SetImage(UIImage.FromBundle("recordbtn"), UIControlState.Normal); isRecording = false; var audioSession = AVAudioSession.SharedInstance(); NSError error = audioSession.SetCategory(AVAudioSessionCategory.Playback); error = audioSession.SetActive(false); if (error != null) { Console.WriteLine(error.LocalizedDescription); } }
public void Stop() { if (recorder == null) { return; } recorder.Stop(); NSData audioData = NSData.FromFile(audioFilePath.Path, 0, out NSError error); if (error != null) { Console.WriteLine(error); return; } audioDataBytes = new byte[audioData.Length]; System.Runtime.InteropServices.Marshal.Copy(audioData.Bytes, audioDataBytes, 0, Convert.ToInt32(audioData.Length)); }
public void Stop(out byte[] fileData) { try { recorder.Stop(); recorder.Dispose(); //_recorder.Reset(); //recorder.Release(); using (var streamReader = new StreamReader(path)) { var bytes = default(byte[]); using (var memstream = new MemoryStream()) { streamReader.BaseStream.CopyTo(memstream); fileData = memstream.ToArray(); } } } catch (Exception e) { string error = e.ToString(); Console.WriteLine(e); fileData = null; } recorder = null; //Bitmap bmThumbnail; //bmThumbnail = ThumbnailUtils.CreateVideoThumbnail(path, ThumbnailKind.MiniKind); //imageThumbnail.setImageBitmap(bmThumbnail); //_player.SetDataSource(path); //_player.Prepare(); //_player.Start(); }
public void StopRecording() { _audioRecorder.Stop(); }