本文介绍了听起来不会从手机出来的时候我通过编码在通话过程中播放它们?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经测试我的应用程序:它开始通过获取外部扬声器来电有足够的容积,使另一面人听我们站在我们这一边播放播放歌曲

I have tested my app: it starts playing a song by getting incoming call on external speaker with enough volume to make person on another side to listen what we play on our side.

但是,当我接听电话,播放歌曲停止。我想通话过程中播放的歌曲让另一边的人能听到它。

But when I answer a call, the playing song stops. I want the song to be playing during call so the person on the other side can hear it.

我想AP preciate任何人,如果他们也面临着这个问题,或者知道解决办法。任何建议

I would appreciate any suggestion from anyone if they has also faced this problem or know a solution.

推荐答案

这是因为当你在通话中,媒体播放路由将按照语音呼叫路由。并且默认路由的输出语音呼叫,如果你不附加任何配件是使用听筒。

That's because while you're in a call, media playback routing will follow the voice call routing. And the default output routing for voice calls if you don't have any accessories attached is to use the earpiece.

您可以尝试等待手机状态切换到的,然后用 setSpeakerPhoneOn 改变输出路由使用扬声器。请注意,这也将路由语音呼叫音频扬声器,不只是媒体音频。

You could try waiting for the phone state to switch to MODE_IN_CALL, and then use setSpeakerPhoneOn to change the output routing to use the loudspeaker. Note that this will also route the voice call audio to the loudspeaker, not just the media audio.

编辑::您可以尝试使用流类型ENFORCED_AUDIBLE(整数7)您的媒体播放。但是,它可能不会在所有设备/所有的Andr​​oid版本。

You could try using the stream type ENFORCED_AUDIBLE (integer value 7) for your media playback. However, it might not work across all devices / all Android versions.

这篇关于听起来不会从手机出来的时候我通过编码在通话过程中播放它们?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 15:50