| Reply | « Previous Thread | Next Thread » |
|
i can't seem to find codes to use a MIDlet to capture video.. can anyone help me? thanx..
|
|
Please check this link.There is an example too..
http://www.forum.nokia.com/info/sw.n..._0_en.pdf.html Hope this helps! Regards Gopal |
|
I'm having the same question. Is it possible to capture video (not just snapshot images like the example in the last reply) with the mmapi? I'm experiencing with mmapi 1.1 and Nokia 6680.
I have been able to use the capture://video to succesfully show the viewfinder, but there seems to be no method for anything else than getSnapShot. Can someone answer this question? |
|
You will have to check the MMAPI javadocs, available in all SDK installations. It has complete examples of capturing videos.
Daniel |
|
I have checked MMAPI javadocs and I haven't found a single reference to capturing video. Just capturing video *images* using "capture://video". These are two different things. I would actually want a video with many frames. So can anyone confirm, is that all that you can do - take snapshots? Or is it possible to capture a real video (with many frames)? Thanks.
|
|
Hi,
You are right, the example is for capturing audio, but the procedure for video is the same: create a player with "capture://video", grab a RecordControl out of it and start recording. As far as I know, though, only S40 3rd edition (some) and Series 60 support capturing video from Java. Daniel |
|
hey! thank you very much for the info... you're a life saver!
|
|
how can i test if it is acutally recording? these are my codes (i apologize for the number of commented out lines):
/* * IndexMIDlet.java * * Created on February 19, 2006, 8:33 PM */ package Surveillance; 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; import java.io.*; /** * * @author Viics * @version */ public class IndexMIDlet extends MIDlet implements CommandListener{ //VIDEO MIDLET private Display display; private Form form; private Command exit, record, stopRecord; private Player player; private VideoControl videoControl; private Video video; private RecordControl recordControl; private Canvas canvas; public IndexMIDlet(){ exit = new Command("Exit", Command.EXIT, 0); record = new Command("Record", Command.ITEM, 0); stopRecord = new Command("Stop Record", Command.ITEM, 0); form = new Form("Surveillance"); //form.addCommand(exit); //form.addCommand(record); form.setCommandListener(this); } public void startApp() { display = Display.getDisplay(this); display.setCurrent(form); showCamera(); } public void pauseApp() { } public void destroyApp(boolean unconditional) { } public void commandAction(Command c, Displayable s){ if (c == exit) { destroyApp(true); notifyDestroyed(); }else if (c == record){ video = new Video(this); video.start(); form.append("Recording..."); }else if (c == stopRecord){ video.stopRecord(); form.append("Stop Recording..."); } } public void showCamera() { try { player = Manager.createPlayer("capture://video"); player.realize(); videoControl = (VideoControl)player.getControl("VideoControl"); canvas = new VideoCanvas(this, videoControl); //canvas.addCommand(back); //canvas.addCommand(capture); canvas.addCommand(record); canvas.addCommand(stopRecord); canvas.addCommand(exit); canvas.setCommandListener(this); display.setCurrent(canvas); player.start(); } catch (IOException ioe) {} catch (MediaException me) {} } class Video extends Thread{ IndexMIDlet midlet; RecordControl rc; public Video(IndexMIDlet midlet) { this.midlet = midlet; } public void run() { //captureVideo(); recordVideo(); } 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) { } } public void recordVideo(){ 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. rc = (RecordControl)player.getControl("RecordControl"); ByteArrayOutputStream output = new ByteArrayOutputStream(); rc.setRecordStream(output); rc.startRecord(); //player.start(); Thread.currentThread().sleep(5000); //rc.commit(); //player.close(); } //catch (IOException ioe) {} //catch (MediaException me) {} catch (InterruptedException ie) { } } public void stopRecord(){ try{ rc.stopRecord(); }catch (Exception e){} } } } |
|
Thanks a lot for the help. Now I got it to work. It is still really simple and all, but at least I know I will get it to work.
Quote:
Now I just have to figure out how to save that to the memory/memory card and/or send it through Http. Help anyone? :) |
|
Hi,
Glad it works. You can use for example ByteArrayOutputStream output = new ByteArrayOutputStream(); rc.setRecordStream(output); which you can convert to a byte array and send it via HttpConnection to a servlet or php script. You can also use the very same code and use the JSR 75 FileConnection API to save the byte array to your local file system. Daniel |
|
can you send me your codes? :D i just want to take a look at how you're doing it. my output always comes out null... this is my email valgino308@yahoo.com thanx
i tried doing this to test if it has recorded: if(output == null){ form.append("null!"); display.setCurrent(form); } it is always null.. i don't know why this line throws a NullPointerException: ByteArrayOutputStream output = new ByteArrayOutputStream(); can't figure out why...
Last edited by bangus : 2006-02-23 at 08:19.
|
|
salamu alikom
i need to record audio & video at the same time & when i test the code which u sent ,i found that the value of rc is always =null,plz,help me,i'm new in working with the j2me Quote:
|
| emanhossny |
| View Public Profile |
| Find all posts by emanhossny |
|
that is the problem that i am also having.. pillar got it to work.. can you post your codes pillar? :D
|
|
Not all phones support video capturing
|
|
It depends on the phones you're testing the code. Not all phones support video capturing...
Daniel |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| Midlet and native video player | greggiannis | Mobile Java General | 2 | 2009-10-22 09:30 |
| bad video capturing thru 6230i | kshitijesh | Mobile Java Media (Graphics & Sounds) | 1 | 2005-10-05 11:56 |
| MMAPI video in a midlet query | greggiannis | Mobile Java Media (Graphics & Sounds) | 0 | 2005-09-02 03:15 |
| Video Player Midlet problem - please help | L_Tambiah | Mobile Java General | 0 | 2004-06-26 16:00 |
| Audio in VIDEO PLAYING in midlet | rossottom | Mobile Java Media (Graphics & Sounds) | 0 | 2003-05-13 18:08 |