>>> just camera is working but the voice does not work when I record video in J2ME
>>> actually when I play and after record the voice does not work
>>> this is a sample of my code
________________________________________________________
Code:public void startRecording() { try { player = Manager.createPlayer("capture://video"); player.addPlayerListener(this); player.realize(); //setup recording record = (RecordControl)player.getControl("RecordControl"); record.setRecordSizeLimit(300000); conn = (FileConnection)Connector.open(PATH,Connector.READ_WRITE); if(!conn.exists()) conn.create(); stream = conn.openOutputStream(); record.setRecordStream(stream); // Grab the video control and set it to the current display. control = (VideoControl)player.getControl("VideoControl"); if (control != null) { control.initDisplayMode(VideoControl.USE_DIRECT_VIDEO,this); control.setDisplaySize(getWidth(),getHeight()); control.setVisible(true); } player.start(); record.startRecord(); } catch(Exception e) { Alert erro = new Alert("Erro",e.toString(),null,AlertType.ERROR); Display.getDisplay(midlet).setCurrent(erro); e.printStackTrace(); } } /** * Start * */ public void startPlaying() { try { player = Manager.createPlayer(PATH); player.addPlayerListener(this); player.realize(); // Grab the video control and set it to the current display. control = (VideoControl)player.getControl("VideoControl"); if (control != null) { control.initDisplayMode(VideoControl.USE_DIRECT_VIDEO,this); control.setDisplaySize(176,144); control.setDisplayLocation((getWidth() - control.getDisplayWidth()) / 2,(getHeight() - control.getDisplayHeight()) / 2); control.setVisible(true); } player.start(); } catch(Exception e) { Alert erro = new Alert("Erro",e.getMessage(),null,AlertType.ERROR); Display.getDisplay(midlet).setCurrent(erro); e.printStackTrace(); } } public void stop() { if(player != null) { try { if(recording) { record.stopRecord(); record.commit(); stream.close(); } player.stop(); player.deallocate(); player.close(); player = null; if(recording) { Alert alert = new Alert("Mensagem","Gravado em " + PATH,null,AlertType.INFO); Display.getDisplay(midlet).setCurrent(alert,this); stream = null; } if(conn != null) conn.close(); } catch(Exception e) { } } }

Reply With Quote

