在通话过程中播放音频文件 [英] play an audio file during the call

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

问题描述

我要在我的应用程序中实现以下要求

I am having the following requirement to be implemented into my application

我想在应答呼叫后/从我的应用程序拨打电话后播放音频文件。我的意思是我想打电话来假装在交通/下雨时通过播放音频文件来打电话..

I want to play an audio file after answering the call / after making a call from my application.i mean that i want to fake the caller to pretend to be in traffic / rain by playing the audio file on call..

请告诉我你的见解

非常感谢您的观点和帮助

Thanks a lot for your views and help

推荐答案

您应该阅读音频会话编程指南,您的要求无法满足。接到电话或系统警报后,您的音频会话将被中断。没有其他办法了。您的应用程序在通话期间无法播放声音。它不会杀死你的应用程序,但是你可以在中断开始/结束时收到通知,以便优雅地做出反应。文档的相关部分(在处理音频中断中):

You should read the Audio Session Programming Guide, your requirements are impossible to meet. On receiving phone calls or on system alarms your audio session is interrupted. There is no way around it. Your application cannot play sound during the call. It does not kill your app however, you can get notifications on interruption begin/end so as to react gracefully. Relevant bit of the document (in "Handling Audio Interruptions"):


添加音频会话代码以处理中断确保您的
当电话呼叫
到达或发出时钟或日历闹钟时,应用程序的音频会继续正常运行。

Adding audio session code to handle interruptions ensures that your application’s audio continues behaving gracefully when a phone call arrives or a Clock or Calendar alarm sounds.

音频中断是取消激活应用程序的音频
会话 - 它会立即停止或暂停您的音频,具体取决于您使用的技术
。当来自内置应用程序的竞争
音频会话激活且会话
未被系统分类以与您的会话混合时,就会发生中断。在您的会话
变为非活动状态后,系统会发送您被中断的消息,您可以通过保存状态,更新用户界面以及
等来响应

An audio interruption is the deactivation of your application’s audio session—which immediately stops or pauses your audio, depending on which technology you are using. Interruptions happen when a competing audio session from a built-in application activates and that session is not categorized by the system to mix with yours. After your session goes inactive, the system sends a "you were interrupted" message which you can respond to by saving state, updating the user interface, and so on.

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

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