This content has been marked as final. Show 5 replies
according to this, you should do setRecordStream or setRecordLocation befor calling a
second time commit() !
Please do read the entire post first. I'm already doing that. That's what i meant by
"...Upon resuming we call
So, in case this is not clear, the sequence goes like this
1. initialize player, recordControl, videoControl and set the RecordStream
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.
At this stage I get everything off my buffer (this.buffer) and I do get my data. I already rechecked it and I AM getting stuff. the problem starts from this point on
4. A while later the user presses 'resume' and I call:
this.buffer = new ByteArrayOutputStream(); recordControl.setRecordStream(this.buffer); recordControl.startRecord();
5. User presses 'pause' - same as in step #3 - and the same code is called
yet, for some reason I'm nolonger able to get anything from this.buffer.
I am following the instructions. I am calling setRecordStream BEFORE resuming. What's happening? Any folks have had similar trouble with this?
I'm using a Sony Ericsson W710i btw.
have you tried with creating a new ByteArrayOutputStream?
I have the same problem. After first commit(), calling setRecordStream() throws IllegalStateException: "startRecord() has been called and commit has not been called". Scheme looks like this:
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 ...
Has anyone handled this?
Maybe author of this thread solved this?
Any help appreciated :)
Moderator advice: Please don't post in threads that are long dead and don't hijack another poster's thread. When you have a question, start your own topic. Feel free to provide a link to an old post that may be relevant to your problem.
Moderator action: Locking this thread.