在耳塞中播放iPhone音频 [英] Play iPhone audio in ear speker

查看:41
本文介绍了在耳塞中播放iPhone音频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们如何使用应用程序中的耳机播放音频.音频的播放就像电话的另一端正在说话一样.

How can we play audio using the ear speaker from an application. The audio plays like some one is talking at the other end of the phone.

谢谢

推荐答案

听起来您正在寻找的是这样的:(来自 Apple的文档)

It sounds like what you're looking for is this: (from Apple's documentation)

音频会话类别路由覆盖

指定是否应覆盖PlayAndRecord类别的默认音频路由.

Specifies whether the default audio route for the PlayAndRecord category should be overridden.

enum {
   kAudioSessionOverrideAudioRoute_None    = 0,
   kAudioSessionOverrideAudioRoute_Speaker = 'spkr'
};

常量

kAudioSessionOverrideAudioRoute_None

kAudioSessionCategory_PlayAndRecord 类别指定输出音频应到达接收器.这是该类别的默认输出音频路由.

Specifies, for the kAudioSessionCategory_PlayAndRecord category, that output audio should go to the receiver. This is the default output audio route for this category.

kAudioSessionOverrideAudioRoute_Speaker

kAudioSessionCategory_PlayAndRecord 类别指定输出音频应传递给扬声器,而不是接收器.

Specifies, for the kAudioSessionCategory_PlayAndRecord category, that output audio should go to the speaker, not the receiver.

讨论 kAudioSessionCategory_PlayAndRecord 类别支持同时输入和输出.您可以使用此类别,例如,为进入iPhone麦克风的音频添加效果.默认情况下,此类别的输出音频会传递到接收器,即您在通话时将其放在耳边的扬声器. kAudioSessionOverrideAudioRoute_Speaker 常量使您可以将输出音频定向到位于手机底部的扬声器.

Discussion The kAudioSessionCategory_PlayAndRecord category supports simultaneous input and output. You could use this category, for example, to add an effect to audio coming into the iPhone’s microphone. By default, output audio for this category goes to the receiver—the speaker you hold to your ear when on a phone call. The kAudioSessionOverrideAudioRoute_Speaker constant lets you direct the output audio to the speaker situated at the bottom of the phone.

这篇关于在耳塞中播放iPhone音频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆