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.
无论声音是否是你app的主要体验方面或只是一个装饰,你都需要知道用户怎么期望声音的表现并满足这些期望。
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.
用户通过音量按钮、静音转化、耳机控制、屏幕上的音量滑块来操作声音。许多第三方的辅助程序也包含音量控制。音频可以被内置或外置的扬声器、耳机、甚至无线的支持AirPlay或蓝牙的设备输出。
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.
静音。用户转换他们的设备到静音状态以避免被不期望的声音打扰,例如铃声和消息提示声。他们也需要禁用那些不重要的声音,包括键盘声、声音效果、游戏原声、或者其他声音反馈。当设备设置为静音,只有明确设置的声音的能被听到,例如电影播放声音、闹钟和语音视频信息。
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.
音量。无论是使用物理设备按钮还是屏幕滑块,用户希望改变的音量是系统范围的所有声音,包括音乐和app声音效果。唯一例外是铃声音量,被单独调整。
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.
耳机。用户使用耳机来独自听声音同时释放他们的双手。当插入耳机时,用户期望在不打断的情况下声音自动改道。当拔出耳机时,他们希望播放马上停止播放。
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.
必要时自动调整等级,但不是所有音量。你的app可以做相对调整,独立的音量等级来获得最棒的混音效果。然而,最终输出需要被系统音量管理。
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.
合适时允许音频改道。用户经常想选择一个不同的音频输出设备。例如,他们想在他们的家庭影院,车载音响, or Apple TV听歌。支持这个特性除非有特别强烈的理由不这么做。
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.
使用系统提供的音量视图来做语音调整。提供调整音频控制的最好界面是使用音量视图。这个视图是可定制的,包括音量等级滑块,甚至包括音频输出改道控制。对于开发者指导, seeMPVolumeView.
Use the system’s sound services for short sounds and vibrations.For developer guidance, seeSystem Sound Services.
对于短音效和震动使用系统提供的声音服务。对于开发者指导,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.
如果声音对于你的app是必要的,分类你的音频。不同的音频分类允许声音被静音用静音按钮,混合其他音频,或者当你的app隐藏在后台时仍然播放。基于它的意义和当前音频状态选择一个分类,然后把它分配到你的音频会话中。例如,如果你不想要让用户从其他app停止听音乐。基本上,当你app在运行时最好避免改变分类,除了那些录音和播放音频在不同时间的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.
在一个打断之后,当合适时继续重放音频。有时候,现在播放的音频被另一个app的音频打断。临时打断例如来电可以被认为是可重启的。永久打断,例如一个被Siri启动的音乐播放列表,被认为不可重启的。一个可重启的打断发生,当打断开始的时候如果该音频正在播放,当打断结束后你的app应该重新播放该音频。
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.
当你的app完成播放临时音频时让其他app知道。如果你的app会临时打断其他app的音频,它应该标记相应的音频会话,这样当可以重新播放时其他app会得到通知。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.
当有意义时相应音频控制。用户在你的app界面之外控制音频播放,例如在控制中心或者他们的耳机,不过你的app在后台还是前台。如果你的app正在播放音频,在一个明确的音频相关环境,或者连接到一个支持AirPlay的设备,响应音频控制是友好的。否则,当一个控制被激活时你app不应该停止其他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中保持一致性。永远不要重新定义音频控制。如果你的app不支持相应控制,只需要不回应它们就行。
网友评论