internal NSString CategoryToToken(AVAudioSessionCategory category) { switch (category) { case AVAudioSessionCategory.Ambient: return(AVAudioSession.CategoryAmbient); case AVAudioSessionCategory.SoloAmbient: return(AVAudioSession.CategorySoloAmbient); case AVAudioSessionCategory.Playback: return(AVAudioSession.CategoryPlayback); case AVAudioSessionCategory.Record: return(AVAudioSession.CategoryRecord); case AVAudioSessionCategory.PlayAndRecord: return(AVAudioSession.CategoryPlayAndRecord); #if !TVOS case AVAudioSessionCategory.AudioProcessing: return(AVAudioSession.CategoryAudioProcessing); #endif case AVAudioSessionCategory.MultiRoute: return(AVAudioSession.CategoryMultiRoute); } return(null); }
public NSError SetCategory(AVAudioSessionCategory category, AVAudioSessionCategoryOptions options) { NSError error; if (SetCategory(CategoryToToken(category), options, out error)) { return(null); } return(error); }
public static void ConfigureAudio(AVAudioSessionCategory mode) { var session = AVAudioSession.SharedInstance(); var err = session.SetCategory(mode); if (err != null) { throw new Exception("Failed to initiate the recorder: " + err.Description); } err = session.SetActive(beActive: true); if (err != null) { throw new Exception("Failed to activate the recorder: " + err.Description); } }
public NSError SetCategory(AVAudioSessionCategory category) { return(SetCategory(CategoryToToken(category))); }
/// <summary> /// Call this method in your iOS project if you'd like the <see cref="AudioPlayer"/> to set the shared <see cref="AVAudioSession"/> /// category to the requested <paramref name="category"/> before playing audio and return it to its previous value after playback is complete. /// <see cref="OnPrepareAudioSession"/> and <see cref="OnResetAudioSession"/> will also be called before and after each playback operation to allow for further session configuration. /// Note that some categories do not support playback. /// </summary> public static void RequestAVAudioSessionCategory(AVAudioSessionCategory category) { requestedAVAudioSessionCategory = category; }
/// <summary> /// Call this method in your iOS project if you'd like the <see cref="AudioRecorderService"/> to attempt to set the shared <see cref="AVAudioSession"/> /// category to the requested <paramref name="category"/> before recording audio and return it to its previous value after recording is complete. /// The default category used will be <see cref="AVAudioSessionCategory.PlayAndRecord"/>. Note that some categories do not support recording. /// </summary> public static void RequestAVAudioSessionCategory(AVAudioSessionCategory category = AVAudioSessionCategory.PlayAndRecord) { requestedAVAudioSessionCategory = category; }
public NSError SetCategory(AVAudioSessionCategory category) { return SetCategory (CategoryToToken (category)); }
internal NSString CategoryToToken(AVAudioSessionCategory category) { switch (category){ case AVAudioSessionCategory.Ambient: return AVAudioSession.CategoryAmbient; case AVAudioSessionCategory.SoloAmbient: return AVAudioSession.CategorySoloAmbient; case AVAudioSessionCategory.Playback: return AVAudioSession.CategoryPlayback; case AVAudioSessionCategory.Record: return AVAudioSession.CategoryRecord; case AVAudioSessionCategory.PlayAndRecord: return AVAudioSession.CategoryPlayAndRecord; #if !TVOS case AVAudioSessionCategory.AudioProcessing: return AVAudioSession.CategoryAudioProcessing; #endif case AVAudioSessionCategory.MultiRoute: return AVAudioSession.CategoryMultiRoute; } return null; }
public NSError SetCategory(AVAudioSessionCategory category, AVAudioSessionCategoryOptions options) { NSError error; if (SetCategory (CategoryToToken (category), options, out error)) return null; return error; }