开发者

How to play a sound during a call on iPhone

开发者 https://www.devze.com 2023-02-20 14:47 出处:网络
I need to make a call in my application and need to play a sound clip in the call. How i can do this?

I need to make a call in my application and need to play a sound clip in the call. How i can do this?

I've tried using AudioToolbox but the sound is very low in the call; please help me, thanks!

EDIT: Thanks for the answers, but it's not for streaming a song; it's for streaming some recorded sentences. Can no one help me? I need to directly stream the audio like an emulation of the microphone, or I nee开发者_JAVA技巧d to play a sound with high volume that can be heared in a call. Thanks for the attention.


Apps each have their own sandboxes, and they are extremely limited to what they can do out of these sandboxes. This includes apps affecting phone calls, SMS and emails. Other than being able to start phone calls and send SMS and emails apps cannot do anything else.

Besides the potential security problems and copyright issues with playing sounds over a phone call, it would be very annoying for the user for this to happen from many apps, so Apple prevents it outright.

Basically what you want to do is not possible on a non-jailbroken iOS device


This is now possible using AVFoundation! As you can see here, when you perform the speak function, the other side will actually be able to hear it as well when you set the mixToTelephonyUplink property to be true!:

let utterance = AVSpeechUtterance(string: "Hello")
utterance.voice = AVSpeechSynthesisVoice(language: "en-GB")
utterance.rate = 0.5

let synthesizer = AVSpeechSynthesizer()
synthesizer.mixToTelephonyUplink = true
synthesizer.speak(utterance)
0

精彩评论

暂无评论...
验证码 换一张
取 消