×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Jan 2007
    Posts
    3

    How to record video and store it in rms??

    Any one help me plzzzz
    Thanks
    Muruga

  2. #2
    Regular Contributor
    Join Date
    Jul 2008
    Location
    Faridabad(Delhi NCR)
    Posts
    343

    Re: How to record video and store it in rms??

    import java.io.IOException;
    import javax.microedition.lcdui.*;
    import javax.microedition.media.*;
    import javax.microedition.media.control.*;
    import javax.microedition.midlet.MIDlet;
    import javax.microedition.media.control.VideoControl;

    public class VideoMIDlet extends MIDlet implements CommandListener {

    private Display display;
    private Form form;
    private Command exit,back,capture,camera;
    private Player player;
    private VideoControl videoControl;
    private Video video;

    public VideoMIDlet() {

    exit = new Command("Exit", Command.EXIT, 0);
    camera = new Command("Camera", Command.SCREEN, 0);
    back = new Command("Back", Command.BACK, 0);
    capture = new Command("Capture", Command.SCREEN, 0);

    form = new Form("Capture Video");
    form.addCommand(camera);
    form.setCommandListener(this);
    }

    public void startApp() {
    display = Display.getDisplay(this);
    display.setCurrent(form);
    }

    public void pauseApp() {}

    public void destroyApp(boolean unconditional) {}

    public void commandAction(Command c, Displayable s) {
    if (c == exit) {
    destroyApp(true);
    notifyDestroyed();
    } else if (c == camera) {
    showCamera();
    } else if (c == back)
    display.setCurrent(form);
    else if (c == capture) {
    video = new Video(this);
    video.start();
    }
    }

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

    videoControl = (VideoControl)player.getControl("VideoControl");
    Canvas canvas = new VideoCanvas(this, videoControl);
    canvas.addCommand(back);
    canvas.addCommand(capture);
    canvas.setCommandListener(this);
    display.setCurrent(canvas);
    player.start();
    } catch (IOException ioe) {} catch (MediaException me) {}
    }

    class Video extends Thread {
    videoMIDlet midlet;
    public Video(VideoMIDlet midlet) {
    this.midlet = midlet;
    }

    public void run() {
    captureVideo();

    }

    public void captureVideo() {
    try {
    byte[] raw = videoControl.getSnapshot(null);
    Image image = Image.createImage(raw, 0, raw.length);
    form.append(image);
    display.setCurrent(form);

    player.close();
    player = null;
    videoControl = null;
    } catch (MediaException me) { }
    }
    };
    }

    import javax.microedition.lcdui.*;
    import javax.microedition.media.MediaException;
    import javax.microedition.media.control.VideoControl;

    public class VideoCanvas extends Canvas {
    private VideoMIDlet midlet;

    public VideoCanvas(VideoMIDlet midlet, VideoControl videoControl) {
    int width = getWidth();
    int height = getHeight();
    this.midlet = midlet;

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

    public void paint(Graphics g) {
    int width = getWidth();
    int height = getHeight();

    g.setColor(0x00ff00);
    g.drawRect(0, 0, width - 1, height - 1);
    g.drawRect(1, 1, width - 3, height - 3);
    }
    Anshu Chauhan
    J2me Developer

  3. #3
    Regular Contributor
    Join Date
    Jul 2008
    Location
    Faridabad(Delhi NCR)
    Posts
    343

    Re: How to record video and store it in rms??

    May b this Help......And u can use byte array stream and get aal the byte of the video...and store it in Rms....But i wana tell u one thing dont try to save it in rms..becoz size of the Rms is Small as compare to Video Size..trying to save it anywhere else
    Anshu Chauhan
    J2me Developer

Similar Threads

  1. Video recorder application
    By kumar_sai123 in forum Symbian Media (Closed)
    Replies: 4
    Last Post: 2007-12-13, 05:16
  2. Video playback with sound but nothing on Screen
    By abdullah829 in forum Mobile Java Media (Graphics & Sounds)
    Replies: 5
    Last Post: 2007-11-30, 14:04
  3. Record video and grabbing frame from video
    By Tobias_80 in forum Mobile Java Media (Graphics & Sounds)
    Replies: 4
    Last Post: 2007-08-16, 12:01
  4. how to record maximum length video on nokia n70
    By zishan in forum News and Announcements
    Replies: 0
    Last Post: 2007-04-10, 23:34
  5. Store huge file to RMS (More than 100kb)
    By alicegue in forum Mobile Java General
    Replies: 4
    Last Post: 2005-12-22, 06:23

Posting Permissions

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