我怎么可以在语音通话过程中发送pre-记录(WAV)文件? [英] How can I send a pre-recorded(wav) file during a voice call?

查看:253
本文介绍了我怎么可以在语音通话过程中发送pre-记录(WAV)文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要开发一个应用程序,通过它,如果主叫用户呼叫你,呼叫应自动无需用户的参与回答来电者可以听到它已经记录了pre-记录的声音和saved.The音频文件应在.WAV format.I搜索在谷歌的帮助,但我才知道,这是不是在Android的可能,但也有具有相同functionality.So我认为有一些可能性this.Excuse我,如果一些Android应用程序问题是wrong.I将不胜感激,如果有一个人帮我,我正在使用的Eclipse太阳神与ADT插件。我已经试过低于code,但它没有工作out.If有人知道答案,请帮助我。我用广播接收器来读取手机状态changes.In CALL_STATE_OFFHOOK,我写了下面code。

 情况下TelephonyManager.CALL_STATE_OFFHOOK:
Toast.makeText(背景下,CALL采摘..,Toast.LENGTH_LONG).show();
Log.d(获得,呼......精选);
最终的MediaPlayer MPLAYER = MediaPlayer.create(背景下,R.raw.music_file);
                    mPlayer.setAudioStreamType(AudioManager.STREAM_VOICE_CALL);
                    。MPLAYER prepareAsync();
                    mPlayer.start();
                    mPlayer.setOnErrorListener(新OnErrorListener(){                        @覆盖
                        公共布尔的onError(MediaPlayer的熔点,诠释了什么,整型附加){
// TODO自动生成方法
mPlayer.reset();
                            返回true;
                        }
                    });
                    AudioManager上午=(AudioManager)context.getSystemService(Context.AUDIO_SERVICE);
                    am.setMode(AudioManager.MODE_IN_CALL);
                    am.setSpeakerphoneOn(假);
                    am.setMicrophoneMute(真);
                    Log.d(呼叫,送音响);
                    mPlayer.reset();
                    mPlayer.release();
                    打破;


解决方案

管道音频转换成一个电话是由Android硬件完全不支持。

I want to develop an application through which if the caller calls you, the call should be answered automatically without user's involvement and the caller could hear a pre-recorded voice which is already recorded and saved.The audio file should be in .wav format.I searched for help in google but i came to know that it is not possible in Android but there are some android applications which have the same functionality.So i think there is some possibility for this.Excuse me if the question is wrong.I would be grateful if some one help me.I am using eclipse Helios with ADT Plugin. I've tried the below code but it didn't work out.If someone know the answer please help me out. I've used broadcast receiver to read the phone state changes.In CALL_STATE_OFFHOOK, i wrote the following code.

case TelephonyManager.CALL_STATE_OFFHOOK:
Toast.makeText(context, "Call Picked..", Toast.LENGTH_LONG) .show();
Log.d("received", "Call Picked....");
final MediaPlayer mPlayer = MediaPlayer.create(context, R.raw.music_file);
                    mPlayer.setAudioStreamType(AudioManager.STREAM_VOICE_CALL);
                    mPlayer.prepareAsync();
                    mPlayer.start();
                    mPlayer.setOnErrorListener(new OnErrorListener() {

                        @Override
                        public boolean onError(MediaPlayer mp, int what, int extra) {
// TODO Auto-generated method 
mPlayer.reset();
                            return true;
                        }
                    });
                    AudioManager am=(AudioManager)context.getSystemService(Context.AUDIO_SERVICE);
                    am.setMode(AudioManager.MODE_IN_CALL);
                    am.setSpeakerphoneOn(false);
                    am.setMicrophoneMute(true);
                    Log.d("in call","sent audio");
                    mPlayer.reset();
                    mPlayer.release();
                    break; 

解决方案

Piping audio into a phone call is completely unsupported by Android hardware.

这篇关于我怎么可以在语音通话过程中发送pre-记录(WAV)文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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