Audio
Whether sound is a primary aspect of your app’s experience or an embellishment, you need to know how people expect sound to behave and meet those expectations.
無(wú)論聲音是否是你app的主要體驗(yàn)方面或只是一個(gè)裝飾准谚,你都需要知道用戶怎么期望聲音的表現(xiàn)并滿足這些期望螟左。
Users manipulate sound through the volume buttons, silence switch, headphone controls, and the onscreen volume slider. Many third-party accessories include sound controls too. Audio can be output through internal or external speakers, headphones, and even wirelessly through an AirPlay-enabled or Bluetooth device.
用戶通過(guò)音量按鈕蜈项、靜音轉(zhuǎn)化、耳機(jī)控制蛤高、屏幕上的音量滑塊來(lái)操作聲音。許多第三方的輔助程序也包含音量控制。音頻可以被內(nèi)置或外置的揚(yáng)聲器钓株、耳機(jī)、甚至無(wú)線的支持AirPlay或藍(lán)牙的設(shè)備輸出陌僵。
Silence.People switch their device to silent to avoid being interrupted by unexpected sounds, such as ringtones and incoming message sounds. They also want nonessential sounds disabled, including keyboard sounds, sound effects, game soundtracks, and other audible feedback. When the device is set to silent, only explicitly initiated sounds should occur, such as audio during media playback, alarms, and audio/video messaging.
靜音轴合。用戶轉(zhuǎn)換他們的設(shè)備到靜音狀態(tài)以避免被不期望的聲音打擾,例如鈴聲和消息提示聲碗短。他們也需要禁用那些不重要的聲音受葛,包括鍵盤聲、聲音效果偎谁、游戲原聲总滩、或者其他聲音反饋。當(dāng)設(shè)備設(shè)置為靜音巡雨,只有明確設(shè)置的聲音的能被聽(tīng)到闰渔,例如電影播放聲音、鬧鐘和語(yǔ)音視頻信息铐望。
Volume.Whether using physical device buttons or an onscreen slider, people expect changes in volume to affect all sound systemwide, including music and in-app sound effects. The only exception is the ringer volume, which is always adjusted separately when audio isn’t actively playing.
音量冈涧。無(wú)論是使用物理設(shè)備按鈕還是屏幕滑塊向挖,用戶希望改變的音量是系統(tǒng)范圍的所有聲音,包括音樂(lè)和app聲音效果炕舵。唯一例外是鈴聲音量何之,被單獨(dú)調(diào)整。
Headphones.People use headphones to hear sound privately and to free their hands. When plugging in headphones, users expect sound to reroute automatically without interruption. When unplugging headphones, they expect playback to pause immediately.
耳機(jī)咽筋。用戶使用耳機(jī)來(lái)獨(dú)自聽(tīng)聲音同時(shí)釋放他們的雙手溶推。當(dāng)插入耳機(jī)時(shí),用戶期望在不打斷的情況下聲音自動(dòng)改道奸攻。當(dāng)拔出耳機(jī)時(shí)蒜危,他們希望播放馬上停止播放。
Adjust levels automatically when necessary, but not the overall volume.Your app can adjust relative, independent volume levels to achieve a great mix of audio. However, the final output should always be governed by the system volume.
必要時(shí)自動(dòng)調(diào)整等級(jí)睹耐,但不是所有音量辐赞。你的app可以做相對(duì)調(diào)整,獨(dú)立的音量等級(jí)來(lái)獲得最棒的混音效果硝训。然而响委,最終輸出需要被系統(tǒng)音量管理。
Permit rerouting of audio when appropriate.People often want to select a different audio output device. For example, they may want to listen to music through their living room stereo, car radio, or Apple TV. Support this capability unless there’s a compelling reason not to.
合適時(shí)允許音頻改道窖梁。用戶經(jīng)常想選擇一個(gè)不同的音頻輸出設(shè)備赘风。例如,他們想在他們的家庭影院,車載音響, or Apple TV聽(tīng)歌纵刘。支持這個(gè)特性除非有特別強(qiáng)烈的理由不這么做邀窃。
Use the system-provided volume view to allow audio adjustments.The best way to provide interface controls for adjusting audio is to use a volume view. This view is customizable, includes a volume-level slider, and even includes a control for rerouting audio output. For developer guidance, seeMPVolumeView.
使用系統(tǒng)提供的音量視圖來(lái)做語(yǔ)音調(diào)整。提供調(diào)整音頻控制的最好界面是使用音量視圖假哎。這個(gè)視圖是可定制的瞬捕,包括音量等級(jí)滑塊,甚至包括音頻輸出改道控制舵抹。對(duì)于開發(fā)者指導(dǎo), seeMPVolumeView.
Use the system’s sound services for short sounds and vibrations.For developer guidance, seeSystem Sound Services.
對(duì)于短音效和震動(dòng)使用系統(tǒng)提供的聲音服務(wù)肪虎。對(duì)于開發(fā)者指導(dǎo),seeSystem Sound Services.
Categorize your audio if sound is essential to your app.Different audio categories allow sounds to be silenced by the silence switch, to mix with other audio, or to play while your app is in the background. Pick a category based on its meaning and the current audio state of the device, and assign it to your audio sessions. For example, don’t make people stop listening to music from another app if you don’t need to. In general, it’s best to avoid changing the category while your app is running, with the exception of apps that record and playback audio at different times. For developer guidance, seeAudio Session Programming Guide.
如果聲音對(duì)于你的app是必要的,分類你的音頻掏父。不同的音頻分類允許聲音被靜音用靜音按鈕笋轨,混合其他音頻,或者當(dāng)你的app隱藏在后臺(tái)時(shí)仍然播放赊淑【粽基于它的意義和當(dāng)前音頻狀態(tài)選擇一個(gè)分類,然后把它分配到你的音頻會(huì)話中陶缺。例如钾挟,如果你不想要讓用戶從其他app停止聽(tīng)音樂(lè)”グ叮基本上掺出,當(dāng)你app在運(yùn)行時(shí)最好避免改變分類徽千,除了那些錄音和播放音頻在不同時(shí)間的app。For developer guidance, seeAudio Session Programming Guide.
Resume audio playback when appropriate after an interruption occurs.Sometimes, currently playing audio is interrupted by audio from a different app. Temporary interruptions such as incoming phone calls are considered resumable. Permanent interruptions, such as a music playlist initiated by Siri, are considered nonresumable. When a resumable interruption occurs, your app should resume playback when the interruption ends if audio was actively playing when the interruption started. For example, a game playing a soundtrack and a media app in the process of playing audio should both resume.
在一個(gè)打斷之后汤锨,當(dāng)合適時(shí)繼續(xù)重放音頻双抽。有時(shí)候,現(xiàn)在播放的音頻被另一個(gè)app的音頻打斷闲礼。臨時(shí)打斷例如來(lái)電可以被認(rèn)為是可重啟的牍汹。永久打斷,例如一個(gè)被Siri啟動(dòng)的音樂(lè)播放列表柬泽,被認(rèn)為不可重啟的慎菲。一個(gè)可重啟的打斷發(fā)生,當(dāng)打斷開始的時(shí)候如果該音頻正在播放锨并,當(dāng)打斷結(jié)束后你的app應(yīng)該重新播放該音頻露该。
Let other apps know when your app finishes playing temporary audio.If your app might temporarily interrupt the audio of other apps, it should flag audio sessions appropriately so other apps get notified when it’s safe to resume. For developer guidance, see theAVAudioSessionSetActiveOptionNotifyOthersOnDeactivationconstant inAVFoundation.
當(dāng)你的app完成播放臨時(shí)音頻時(shí)讓其他app知道。如果你的app會(huì)臨時(shí)打斷其他app的音頻第煮,它應(yīng)該標(biāo)記相應(yīng)的音頻會(huì)話解幼,這樣當(dāng)可以重新播放時(shí)其他app會(huì)得到通知。For developer guidance, see theAVAudioSessionSetActiveOptionNotifyOthersOnDeactivationconstant inAVFoundation.
Respond to audio controls only when it makes sense.People can control audio playback from outside of your app’s interface, such as in Control Center or with controls on their headphones, regardless of whether your app is in the foreground or background. If your app is actively playing audio, in a clear audio-related context, or connected to an AirPlay-enabeld device, it’s fine to respond to audio controls. Otherwise, your app shouldn't halt another app’s audio that may be playing when a control is activated.
當(dāng)有意義時(shí)相應(yīng)音頻控制空盼。用戶在你的app界面之外控制音頻播放书幕,例如在控制中心或者他們的耳機(jī)新荤,不過(guò)你的app在后臺(tái)還是前臺(tái)揽趾。如果你的app正在播放音頻,在一個(gè)明確的音頻相關(guān)環(huán)境苛骨,或者連接到一個(gè)支持AirPlay的設(shè)備篱瞎,響應(yīng)音頻控制是友好的。否則痒芝,當(dāng)一個(gè)控制被激活時(shí)你app不應(yīng)該停止其他app正在播放的音頻俐筋。
Don’t repurpose audio controls.People expect audio controls to behave consistently in all apps. Never redefine the meaning of an audio control. If your app doesn’t support certain controls, then it simply shouldn’t respond to them.
不要改變音頻控制的意圖。用戶期望音頻控制在app中保持一致性严衬。永遠(yuǎn)不要重新定義音頻控制澄者。如果你的app不支持相應(yīng)控制,只需要不回應(yīng)它們就行请琳。