The choice of avaudiosessioncategory

Source: Internet
Author: User

Avaudiosessioncategoryambient or kaudiosessioncategory_ambientsound--are used for non-voice-based applications, and apps that use this category will be muted with the mute key and the screen off. It does not stop other apps from playing sound, and can play sounds with other apps such as Ipod,safari. Note: The category cannot play sound avaudiosessioncategorysoloambient or kaudiosessioncategory_soloambientsound--in the background Similar to the avaudiosessioncategoryambient, the difference is that it stops other apps from playing sounds. This category is the default category. The category cannot play sound avaudiosessioncategoryplayback or kaudiosessioncategory_mediaplayback--in the background for voice-based applications, Apps that use this category do not mute with the mute key and the screen off. You can play sound Avaudiosessioncategoryrecord or Kaudiosessioncategory_recordaudio in the background ——— for apps that need to be recorded, and after you set that category, in addition to the call tones Other system sounds other than alarm or calendar reminders will not be played. This category only provides a simple recording function. Avaudiosessioncategoryplayandrecord or kaudiosessioncategory_playandrecord--for applications that need to play both sound and recording Voice chat apps (such as) should use this category. This category provides recording and playback functions. If your app needs an iphone handset, the category is your only option, and the default exit for sound in that category is the handset (in the absence of an external device). Note: Not an app can only use a category, the program should be based on the actual need to switch the different category, for example, when recording, it needs to be set to Avaudiosessioncategoryrecord, when the recording ends, You should change the category to Avaudiosessioncategoryambient,avaudiosessioncategorysoloambient or AV according to your program needsOne of the audiosessioncategoryplayback. <pre name= "code" class= "OBJC" > Set category

Nserror *setcategoryerror = nil;  BOOL success = [[Avaudiosession sharedinstance]                  setcategory:avaudiosessioncategoryambient                  Error: & Setcategoryerror];    if (!success) {/* Handle the error in Setcategoryerror */}  


The choice of avaudiosessioncategory

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.