| Reply | « Previous Thread | Next Thread » |
|
HI all,
I wana Read a Video from My Java Code on My Nokia 6131, please can some one help me. Ziad, |
|
Join Date: Feb 2008
Posts: 2,544
Location: Bhavnagar, Gujarat, India
gaba88
Online
Forum Nokia Champion
|
|
|
Quote:
have a look at this wiki link it i hope it will help you definitely. Regards Gaba88 Gargi Das- http://gargidas.blogsot.com Forum Nokia Python Wiki Learn Python at http://mobapps.org/PyS60 |
|
Hi Gaba88,
Thanks for you help, but I do this but nothing hapend. Code:
protected void startApp() throws MIDletStateChangeException {
_display = Display.getDisplay(this);
form1 = new Form("Video");
_display.setCurrent(form1);
VideoControl vdc;
try{
InputStream is = getClass().getResourceAsStream("file:///C:/predefgallery/predefvideos/a.3gp");
Player player = Manager.createPlayer(is, "video/3gp");
player.realize();
vdc = (VideoControl) player.getControl("VideoControl");
vdc.initDisplayMode(VideoControl.USE_DIRECT_VIDEO, this);
if(vdc != null)
{
//vdc.setDisplayLocation((form1.getWidth()/2 - vdc.getSourceWidth()/2), ((form1.getHeight()/2 - vdc.getSourceHeight()/2)-30));
vdc.setDisplayFullScreen(true);
vdc.setVisible(true);
player.start();
}
}catch(Exception e){}
}
}
Ziad |
|
Hi belzi,
if nothing happens, you're probably getting some Exceptions in your app. Try showing some meaningful infos in your catch block (e.g.: show an Alert, append an Item to your Form, ...), so that you can easily spot out the issue. Pit |
|
HI jappit,
I tried the solution that you proposed to me, and actually I find an Exception : Param is null , what do you think about it. Code:
protected void startApp() throws MIDletStateChangeException {
_display = Display.getDisplay(this);
stringitem = new StringItem("test","test");
form1 = new Form("Video");
_display.setCurrent(form1);
VideoControl vdc;
try{
InputStream is = getClass().getResourceAsStream("file:///C:/predefgallery/predefvideos/a.3gp");
Player player = Manager.createPlayer(is, "video/3gp");
player.realize();
vdc = (VideoControl) player.getControl("VideoControl");
vdc.initDisplayMode(VideoControl.USE_DIRECT_VIDEO, this);
if(vdc != null)
{
//vdc.setDisplayLocation((form1.getWidth()/2 - vdc.getSourceWidth()/2), ((form1.getHeight()/2 - vdc.getSourceHeight()/2)-30));
vdc.setDisplayFullScreen(true);
vdc.setVisible(true);
player.start();
}
}catch(Exception e){
stringitem.setText("exception : "+e.getMessage());
}
}
Ziad |
|
belzi, getResourceAsStream is creating an input stream of a file inside the JAR file.
So you need to include the video file in the JAR file and then provide that URL (something like /res/video.3gp or /video.3gp depending where in the JAR file you stored that video file) Hartti |
|
Hi,
Thanks for your help but I have my 3gp video in a file system, so i must use FileConnetion !! or there is other solution ?? Regards ziad |
|
Hi again,
Now i have correct My code, but still have an Exception Container must be a Canvas, can some one show me how can i use a Canvas as a container. Code:
protected void startApp() throws MIDletStateChangeException {
_display = Display.getDisplay(this);
stringitem = new StringItem("test","test");
stringitem1 = new StringItem("test","test");
form1 = new Form("Video");
form1.append(stringitem);
form1.append(stringitem1);
_display.setCurrent(form1);
VideoControl vdc;
try{
//FileConnection fc = (FileConnection)Connector.open("file:///C:/predefgallery/predefvideos/a.3gp",Connector.READ_WRITE);
//InputStream is = fc.openInputStream();
Player player = Manager.createPlayer("file:///C:/predefgallery/predefvideos/a.3gp");
player.realize();
vdc = (VideoControl) player.getControl("VideoControl");
vdc.initDisplayMode(VideoControl.USE_DIRECT_VIDEO, this);
if(vdc != null)
{
//vdc.setDisplayLocation((form1.getWidth()/2 - vdc.getSourceWidth()/2), ((form1.getHeight()/2 - vdc.getSourceHeight()/2)-30));
vdc.setDisplayFullScreen(true);
vdc.setVisible(true);
}
player.start();
}catch(IOException e){
stringitem.setText("IO exception : "+e.getMessage());
}catch(MediaException e){
stringitem1.setText("Media exception : "+e.getMessage());
}
}
ziad |
|
hi again,
I fing a solution Code:
VideoControl vdc;
try{
Player player = Manager.createPlayer("file:///C:/predefgallery/predefvideos/a.3gp");
player.realize();
//player.prefetch();
vdc = (VideoControl) player.getControl("VideoControl");
Item it = (Item)vdc.initDisplayMode(VideoControl.USE_GUI_PRIMITIVE , null);
if(vdc != null)
{
stringitem.setText("suis la vdc");
//vdc.setDisplayLocation((form1.getWidth() - vdc.getSourceWidth()), ((form1.getHeight() - vdc.getSourceHeight())));
//vdc.setDisplaySize(form1.getWidth(), form1.getHeight());
vdc.setDisplayFullScreen(true);
vdc.setVisible(true);
}
form1.append(it);
player.start();
}catch(IOException e){
stringitem.setText("IO exception : "+e.getMessage());
}catch(MediaException e){
stringitem1.setText("Media exception : "+e.getMessage());
}
->VideoControl.USE_GUI_PRIMITIVE can be implemented for GUIControl like form but without sound, knowing that the video is with a sound, is ther a solution to play a video with a sound. regards, ziad |
|
You can try these:
* get and use the VolumeControl of your Player, and modify video volume with it Code:
(VolumeControl)player.getControl("VolumeControl");
Pit |
|
HI,
I tried this, but the video still without sound. Code:
vc = (VolumeControl)player.getControl("VolumeControl");
vc.setLevel(80);
regards ziad |
|
Sorry, my previous 2nd point was a bit inaccurate: you can equally try to set your 6131 phone in General mode (if it is not already set) and check what happens.
Pit |
|
HI,
My 6131 Nokia phone is already in General mode, and nothing happens. ziad |
|
Have you also enabled sounds for the applications?
If I remember correctly, that setting is available somewher in the Options menu when you are in the Application list (or the list of application folders and you have the correct folder selected...can't remember which, sorry) Hartti |
|
HI,
I tried all these Options and still have the same problem NO SOUND. ziad |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| how to read a video from a file? | freesui1984 | General Symbian C++ | 3 | 2007-12-18 02:56 |
| FAQ (General issues) for Java discussion boards - read this before posting | hartti | Mobile Java General | 2 | 2007-02-06 16:16 |
| 7710 Expert pls help! Java virtual machines and unable read Front | enguyen01 | General Browsing | 2 | 2006-05-17 17:28 |
| interactive VIDEO app - C++ or JAVA | ninku6a | Symbian User Interface | 0 | 2006-02-20 00:24 |
| Is it possible to put picture or video in code? | vemaka | General Symbian C++ | 1 | 2004-10-04 11:02 |