audio - Android recording and playing +speakerphone as an option -
i programming sip application android. during call must record microphone input , play incoming audio. there must optional using of speakerphone. must android 1.5+ (1.5, 1.6, 2.0, 2.1, 2.2, future versions) compatible , device portable.
ok. using audiotrack play incoming audio, audiorecord record data microphone , audiomanager.setspeakerphoneon() enable or disable speakerphone.
sounds simple not simple should be. audiomanager.setspeakerphoneon(false) not work unless audiomanager.setmode(audiomanager.mode_in_call) called. have in mode_in_call.
still ok , simple , works on g1 android 1.6, older samsung phone, emulators, many our customer devices etc. not work everywhere :(
on samsung tablet gt-p1000 stream of 0, 0, 0, 0, ... microphone input. think same problem on motorola phones (customers complain). after test realised caused audiomanager.setmode(audiomanager.mode_in_call). causes microphone not work on devices. have call because otherwise can not disable speakerphone.
is there simple way how make simple, correct , working? , if possible without hell sipdroid highly dangerous source code:
if (rtpstreamreceiver.samsung) { audiomanager = (audiomanager) receiver.mcontext.getsystemservice(context.audio_service); am.setmode(audiomanager.mode_in_call); am.setmode(audiomanager.mode_normal); }
or
void initmode() { samsung = build.model.contains("samsung") || build.model.contains("sph-") || build.model.contains("sgh-") || build.model.contains("gt-"); if (receiver.call_state == useragent.ua_state_incoming_call && (receiver.pstn_state == null || receiver.pstn_state.equals("idle"))) { setmode(audiomanager.mode_normal); }
thanks lot jan
try out........
audiomanager audio = (audiomanager) context.getsystemservice(context.audio_service); audio.setringermode(audiomanager.ringer_mode_normal);
Comments
Post a Comment