用于VOIP的J2ME语音捕获

时间:2011-09-27 10:48:29

标签: java java-me nokia voip mmapi

如何在j2me设备中捕获VOIP的音频? 我尝试RecordControl,但直到commit()它没有提供数据,并且 在尝试循环时,每次它都要求用户提交权限并将字节提供给程序。 我在诺基亚6300 s40手机上进行了测试,这是 示例源代码

            p = Manager.createPlayer("capture://audio");
            p.realize();  
            RecordControl rc = (RecordControl)p.getControl("RecordControl");                

            ByteArrayOutputStream output = new ByteArrayOutputStream();
            rc.setRecordStream(output);                
            rc.startRecord();
            p.start();
            messageItem.setText("recording...");
            Thread.currentThread().sleep(700);
            messageItem.setText("done!");

            //  rc.commit();  
            output.flush();             
            Thread.currentThread().sleep(700);
            rc.stopRecord();
            //  rc.commit();  
            output.flush();
            recordedSoundArray = output.toByteArray();    
            // shows 0 for the length if the commit is not called
            label.setText(recordedSoundArray.length+""); 
            p.close();

0 个答案:

没有答案
相关问题