Upon resuming we call
however when we call recordControl.commit() the SECOND TIME no more data can be retrieved. Meanwhile, We're not closing or stopping the Player at all. We even went as far as creating a new recordControl after every pause but no data could be retrieved after commit. It seems as if only one call to commit() is allowed per player per RecordControl... this seems bogus. Are calls to setRecordStream and startRecord enough for commit to work multiple times for a single realized player? If so, is this the correct way? Thanks
2. start like this:
player = Manager.createPlayer("capture://audio_video"); player.realize(); videoControl = (VideoControl)(player.getControl("VideoControl")); videoControl.initDisplayMode(VideoControl.USE_DIRECT_VIDEO,this.canvas); recordControl = (RecordControl)player.getControl("RecordControl"); recordControl.setRecordStream(this.buffer);
3. user presses "pause" and EVERYTHING we do is;
videoControl.setVisible(true); recordControl.startRecord(); player.start();
I've stried stopping the player also but it shouldn't be necessary, so I'm not stopping it. Notice that I'm not closing the player either.
this.buffer = new ByteArrayOutputStream(); recordControl.setRecordStream(this.buffer); recordControl.startRecord();
yet, for some reason I'm nolonger able to get anything from this.buffer.
It's obvious that commit() is called befere second setRecordStream() but exception states otherwise
Player p= Manager.createPlayer("capture://audio?encoding=pcm"); p.realize(); RecordControl rc= (RecordControl)p.getControl("RecordControl"); ByteArrayOutputStream nbos= new ByteArrayOutputStream(); rc.setRecordStream(nbos); p.start(); rc.startRecord(); Thread.sleep(6000); rc.stopRecord(); rc.commit(); nbos.flush(); byte barr= nbos.toByteArray(); // up to here everything is ok and i get my recorded bytes Thread.sleep(5000); // let's wait a moment before starting next recording rc.setRecordStream(nbos); //this line throws IllegalStateException //I also tried rc.setRecordStream(new ByteArrayOutputStream()); but no effect ...