×

Discussion Board

Page 1 of 3 123 LastLast
Results 1 to 15 of 43

Thread: RecordControl

  1. #1
    Regular Contributor
    Join Date
    Aug 2008
    Posts
    166

    RecordControl

    getting null pointer at


    record = (RecordControl)player.getControl("RecordControl");

    even on emulator
    plz tell me how to resolve this prblm

    Player player = Manager.createPlayer("capture://video");

    player.addPlayerListener(this);
    player.realize();

    its ok till here but after this null ptr arises


    record = (RecordControl)player.getControl("RecordControl");

  2. #2
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Thumbs up Re: RecordControl

    Hi,
    I guess Either the player of the record object must be null,
    check the code

    try {
    // Create a Player that captures live audio.
    Player p = Manager.createPlayer("capture://audio");
    p.realize();
    // Get the RecordControl, set the record stream,
    // start the Player and record for 5 seconds.
    RecordControl rc = (RecordControl)p.getControl("RecordControl");
    ByteArrayOutputStream output = new ByteArrayOutputStream();
    rc.setRecordStream(output);
    rc.startRecord();
    p.start();
    Thread.currentThread().sleep(5000);
    rc.commit();
    p.close();
    } catch (IOException ioe) {
    } catch (MediaException me) {
    } catch (InterruptedException ie) { }
    and the link

    http://discussion.forum.nokia.com/fo...ad.php?t=89162

    please check the code by putting the println()'s or debug.
    Thanks,
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  3. #3
    Regular Contributor
    Join Date
    Aug 2008
    Posts
    166

    Re: RecordControl

    hi raj

    player object is having some reference but when it is passed to record control obj rc having null
    Player player = Manager.createPlayer("capture://video");

    player.addPlayerListener(this);
    player.realize();

    //setup recording

    record = (RecordControl)player.getControl("RecordControl");
    record.setRecordLocation("file:///c:/videos/");
    record.setRecordSizeLimit(300000);

    conn = (FileConnection)Connector.open("capture://video",Connector.READ_WRITE);
    if(!conn.exists()) conn.create();
    stream = conn.openOutputStream();
    record.setRecordStream(stream);
    tell me whether this right or not

  4. #4
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Thumbs up Re: RecordControl

    Hi,
    I gave you that code.why dont you try with that..doing some work on it..
    Thanks,
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  5. #5
    Regular Contributor
    Join Date
    Aug 2008
    Posts
    166

    Re: RecordControl

    il definitely try tnks for the code,

    only difference in ur code is it records audio and writes to stream whereas my code records video writes o/p to a location

    thnks again il try ur code also

  6. #6
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Thumbs up Re: RecordControl

    Hi,
    Yeah thats true..thats the difference ..
    However you can just change that and can work..right..
    I hope that will help..
    Thanks,
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  7. #7
    Registered User
    Join Date
    Mar 2009
    Posts
    33

    Re: RecordControl

    Hi i am Using the Same Code for Nokia 3110c and nokia 5220 musicxpress its Working very Fine but once i m running it on Nokia 5880 xpress Music its not able to store the stream into file can any body help me plz its too urgent!!

    Even once i m tring to record the video and trying to upload the stream to the server then also giving the same error any idea ??

  8. #8
    Registered User
    Join Date
    Mar 2009
    Posts
    33

    Re: RecordControl

    hi all this here i m facing one problem i m recording video using record control in nokia 5880 xpress music but i am not storing it any where in the file system i m uploading it to my server but the problem is the qualitiy of the video is not at all good means at some places it get stoped and resume the play from some diff. place here i m giving u my code if have any solution plz gimme


    private void showCamera()
    {
    try {
    player = Manager.createPlayer("capture://video");
    player.realize();

    videoControl = (VideoControl)player.getControl("VideoControl");
    int width = getWidth();
    int height = getHeight();

    videoControl.initDisplayMode(VideoControl.USE_DIRECT_VIDEO, this);
    try {
    videoControl.setDisplayLocation(2, 2);
    videoControl.setDisplaySize(width - 4, height - 4);
    } catch (MediaException me) {}

    videoControl.setVisible(true);


    } catch (IOException ioe) {} catch (MediaException me) {}
    }


    private void RecordVideo()
    {
    try{
    control = (RecordControl)player.getControl("RecordControl");
    control.setRecordStream(Bstream);
    player.start();
    repaint();
    control.startRecord();
    }
    catch (Exception e)
    {
    Alert alert = new Alert("Error
    Record",e.getMessage),null,AlertType.ERROR);
    Display.getDisplay(mid).setCurrent(alert);
    }
    }


    private void StopVideoRecording()
    {
    try{
    control.stopRecord();
    control.commit();
    //Bstream.close();
    FileUploader uploader = new FileUploader(Bstream.toByteArray
    (),System.currentTimeMillis()+".mp4");
    player.stop();
    player.deallocate();
    player.close();
    Bstream = null;
    repaint();
    }
    catch (Exception e)
    {
    Alert alert = new Alert("Stop",e+"",null,AlertType.ERROR);
    Display.getDisplay(mid).setCurrent(alert);
    }
    }

    /**
    Now this is the code for file upload
    */

    public void upload(byte[] imageData, String url,int length,String Filename)
    {
    url+="&filename="+Filename+"&filesize="+length;
    DataOutputStream oStrm = null;
    ContentConnection connection = null;
    try {
    connection = (ContentConnection) Connector.open(url);
    oStrm = connection.openDataOutputStream();
    oStrm.write(imageData);
    oStrm.flush();
    }
    catch (IOException e)
    {
    }
    }


    Thnaks and Regards
    Shashank Shekhar

  9. #9
    Super Contributor
    Join Date
    Sep 2008
    Location
    Noida, U.P.
    Posts
    1,330

    Thumbs up Re: RecordControl

    Hi,
    Was u checked out that after uploading the data to server that the uploaded video is not proper.

    Also u can try RecordControl.setRecordLocation(url); no need of data uploader class. can try in this way too..

    private void showCamera()
    {
    try {
    player = Manager.createPlayer("capture://video");
    player.realize();

    videoControl = (VideoControl)player.getControl("VideoControl");
    int width = getWidth();
    int height = getHeight();

    videoControl.initDisplayMode(VideoControl.USE_DIRECT_VIDEO, this);
    try {
    videoControl.setDisplayLocation(2, 2);
    videoControl.setDisplaySize(width - 4, height - 4);
    } catch (MediaException me) {}

    videoControl.setVisible(true);


    } catch (IOException ioe) {} catch (MediaException me) {}
    }


    private void RecordVideo()
    {
    try{
    control = (RecordControl)player.getControl("RecordControl");
    control.setRecordLocation(URL);// eg: http://abc.com/..
    player.start();
    repaint();
    control.startRecord();
    }
    catch (Exception e)
    {
    Alert alert = new Alert("Error
    Record",e.getMessage),null,AlertType.ERROR);
    Display.getDisplay(mid).setCurrent(alert);
    }
    }


    private void StopVideoRecording()
    {
    try{
    control.stopRecord();
    control.commit();
    player.stop();
    player.deallocate();
    player.close();

    repaint();
    }
    catch (Exception e)
    {
    Alert alert = new Alert("Stop",e+"",null,AlertType.ERROR);
    Display.getDisplay(mid).setCurrent(alert);
    }
    }

    pls check and reply

    thanks,
    jitu_goldie..
    thanks,
    jitu_goldie..

    KEEP TRYING..

  10. #10
    Registered User
    Join Date
    Mar 2009
    Posts
    33

    Re: RecordControl

    ya u r right .. the video is not proper ... thanks i will try your idea thanks

  11. #11
    Regular Contributor
    Join Date
    Nov 2007
    Posts
    254

    Re: RecordControl

    Quote Originally Posted by jitu_goldie View Post
    Hi,
    Was u checked out that after uploading the data to server that the uploaded video is not proper.

    Also u can try RecordControl.setRecordLocation(url); no need of data uploader class. can try in this way too..

    private void showCamera()
    {
    try {
    player = Manager.createPlayer("capture://video");
    player.realize();

    videoControl = (VideoControl)player.getControl("VideoControl");
    int width = getWidth();
    int height = getHeight();

    videoControl.initDisplayMode(VideoControl.USE_DIRECT_VIDEO, this);
    try {
    videoControl.setDisplayLocation(2, 2);
    videoControl.setDisplaySize(width - 4, height - 4);
    } catch (MediaException me) {}

    videoControl.setVisible(true);


    } catch (IOException ioe) {} catch (MediaException me) {}
    }


    private void RecordVideo()
    {
    try{
    control = (RecordControl)player.getControl("RecordControl");
    control.setRecordLocation(URL);// eg: http://abc.com/..
    player.start();
    repaint();
    control.startRecord();
    }
    catch (Exception e)
    {
    Alert alert = new Alert("Error
    Record",e.getMessage),null,AlertType.ERROR);
    Display.getDisplay(mid).setCurrent(alert);
    }
    }


    private void StopVideoRecording()
    {
    try{
    control.stopRecord();
    control.commit();
    player.stop();
    player.deallocate();
    player.close();

    repaint();
    }
    catch (Exception e)
    {
    Alert alert = new Alert("Stop",e+"",null,AlertType.ERROR);
    Display.getDisplay(mid).setCurrent(alert);
    }
    }

    pls check and reply

    thanks,
    jitu_goldie..
    hi jitu
    i think that the network operation to send the data directly may create a bottleneck in the recording as the camera will generate the data very fastly and the network will not be able to send it that fast and hence may slow down the entire process

    This is my doubt plz clarify it
    regards
    Arun Gupta

  12. #12
    Super Contributor
    Join Date
    Sep 2008
    Location
    Noida, U.P.
    Posts
    1,330

    Thumbs up Re: RecordControl

    Hi,

    Quote Originally Posted by arungupta_2jan View Post
    hi jitu
    i think that the network operation to send the data directly may create a bottleneck in the recording as the camera will generate the data very fastly and the network will not be able to send it that fast and hence may slow down the entire process

    This is my doubt plz clarify it
    regards
    Arun Gupta

    have u read out the functionality of setRecordLocation(String URL). Pls check and confirm.
    thanks,
    jitu_goldie..

    KEEP TRYING..

  13. #13
    Registered User
    Join Date
    Mar 2009
    Posts
    33

    Re: RecordControl

    can you tell me the procedure of recording more than 5 sec of video ... atleast i want to store the video for 5 min is their any way to record the video of that much time ...

    i am using one concept that i m using two stream mean while one stream will record the video one stream will save it to file and vice versa..


    Do you have any idea abt that.. any alternative method if u have then tell me plz

    Thanks and Regards
    Shashank Shekhar

  14. #14
    Super Contributor
    Join Date
    Sep 2008
    Location
    Noida, U.P.
    Posts
    1,330

    Thumbs up Re: RecordControl

    Hi,
    The code given in my previous post by me is well tested for 10 minutes of recording and is working well. You can use any one of the option from setRecordStream or setRecordLocation for this. Only after commiting the recordcontrol u can access the data. If u want to save the recorded file to file system then pls use setRecordstream else in case of server uploading can take any of the method discuss above. whatever u want to do u have to call commit function before uploading or saving file to device.

    If still u have anymore confusion please discuss here.

    thanks,
    jitu_goldie..
    thanks,
    jitu_goldie..

    KEEP TRYING..

  15. #15
    Registered User
    Join Date
    Mar 2009
    Posts
    33

    Re: RecordControl

    hi can i merge two 3gp video in j2me

Similar Threads

  1. Record Video using RecordControl J2ME
    By abdulhye in forum Mobile Java Media (Graphics & Sounds)
    Replies: 4
    Last Post: 2011-08-25, 13:40
  2. Sony Ericsson w580 supported capture video (RecordControl)?
    By crashov3r in forum Mobile Java Tools & SDKs
    Replies: 15
    Last Post: 2008-10-05, 16:10
  3. j2me recordControl and player record sound "continuesly"...
    By jimmyteoh in forum Mobile Java Media (Graphics & Sounds)
    Replies: 1
    Last Post: 2008-01-04, 15:53
  4. RecordControl problem
    By gordon32 in forum Mobile Java Media (Graphics & Sounds)
    Replies: 4
    Last Post: 2007-03-09, 01:57
  5. Strange RecordControl behaviour in N93
    By neovoen in forum Mobile Java Media (Graphics & Sounds)
    Replies: 4
    Last Post: 2006-09-16, 18:35

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×