5 Replies Latest reply on Nov 20, 2010 11:19 AM by darrylburke

    RecordControl commit doesn't work second time

      I'm writing a video app that needs to be paused. When paused we call commit and save the data locally.
      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
        • 1. Re: RecordControl commit doesn't work second time

          according to this, you should do setRecordStream or setRecordLocation befor calling a
          second time commit() !
          • 2. Re: RecordControl commit doesn't work second time
            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
            player = Manager.createPlayer("capture://audio_video");
            videoControl = (VideoControl)(player.getControl("VideoControl"));
            recordControl = (RecordControl)player.getControl("RecordControl");
            2. start like this:
            3. user presses "pause" and EVERYTHING we do is;
            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();

            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.

            • 3. Re: RecordControl commit doesn't work second time
              have you tried with creating a new ByteArrayOutputStream?
              • 4. Re: RecordControl commit doesn't work second time
                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:
                Player p= Manager.createPlayer("capture://audio?encoding=pcm");
                RecordControl rc= (RecordControl)p.getControl("RecordControl");
                ByteArrayOutputStream nbos= new ByteArrayOutputStream();
                 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
                It's obvious that commit() is called befere second setRecordStream() but exception states otherwise
                Has anyone handled this?

                Maybe author of this thread solved this?

                Any help appreciated :)
                • 5. Re: RecordControl commit doesn't work second time
                  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.