videoControl return null while trying to record video

Discussion in 'General Computer Support' started by aaozgull, Mar 13, 2008.

  1. aaozgull

    aaozgull

    Joined:
    Mar 12, 2008
    Messages:
    1
    RecordControl return null while trying to record video

    can any body help me in my problem.I m trying to capture the video and wanna record it. it capture well but when i try for record. RecordControl returns null.


    private void showCamera() {

    try {

    releaseResources();
    player = Manager.createPlayer("capture://video");
    player.addPlayerListener(this);
    player.realize();

    videoControl = (VideoControl)player.getControl("VideoControl");

    aVideoCanvas = new VideoCanvas();
    videoControl.setVisible(true);
    aVideoCanvas.initControls(videoControl, player);


    aVideoCanvas.addCommand(CMD_BACK);
    aVideoCanvas.addCommand(CMD_EXIT);
    aVideoCanvas.setCommandListener(this);
    parentMidlet.getDisplay().setCurrent(aVideoCanvas);

    player.start();
    contentType = player.getContentType();




    }catch(Exception e) {
    e.printStackTrace();

    }
    }

    private void releaseResources() {
    if ( player != null ) {
    try {
    player.stop();
    player.close();
    }catch(Exception e){}
    }
    }

    class CameraThread extends Thread {

    public CameraThread() {
    }

    public void run() {
    showCamera();
    }
    }

    class VideoRecordingThread extends Thread {

    public VideoRecordingThread() {
    }

    public void run() {
    recordVideo();
    }

    public void recordVideo(){
    try {

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

    if ( rc == null ) {
    System.out.println("NULL RECORD CONTROL");
    return;
    }
    output = new ByteArrayOutputStream();
    rc.setRecordStream(output);
    rc.startRecord();

    }
    catch (Exception e) {
    }
    }


    thanx in advance
    Last edited: Mar 13, 2008
    aaozgull, Mar 13, 2008
    #1
    1. Advertising

  2. aaozgull

    Anna nguyen

    Joined:
    Apr 28, 2011
    Messages:
    1
    HI aaozgull
    I m trying a Videorecoder code, but it also returns null as you.i don't know why? if you have answering, please to send email for me, thanks
    email:ngoc.coltech@gmail.com

    public void startRecording() {
    videoPath = PATH + getFileName();
    System.err.println(videoPath);
    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(videoPath,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();
    }
    }
    Anna nguyen, Apr 28, 2011
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mel

    Null Route

    Mel, Jan 11, 2004, in forum: Cisco
    Replies:
    1
    Views:
    2,251
    Hansang Bae
    Jan 11, 2004
  2. reply@newsgroup.please
    Replies:
    2
    Views:
    1,095
    Bruce T. Berger
    Dec 1, 2003
  3. K.J. 44
    Replies:
    2
    Views:
    889
    Walter Roberson
    Sep 6, 2006
  4. slsbrooks
    Replies:
    0
    Views:
    387
    slsbrooks
    Aug 3, 2006
  5. Something wonderful

    Trying to record an answer machine message

    Something wonderful, Feb 19, 2005, in forum: NZ Computing
    Replies:
    3
    Views:
    495
    Adder
    Feb 20, 2005
Loading...

Share This Page