You Are Here:

Community: Developer Discussion Boards

Reply « Previous Thread | Next Thread »

#1 Old How to read a video with Java Code - 2008-09-08, 18:44

Join Date: Sep 2008
Posts: 21
belzi
Offline
Registered User
HI all,

I wana Read a Video from My Java Code on My Nokia 6131, please can some one help me.

Ziad,
Reply With Quote

#2 Old Re: How to read a video with Java Code - 2008-09-08, 19:59

Join Date: Feb 2008
Posts: 2,544
Location: Bhavnagar, Gujarat, India
Send a message via Yahoo to gaba88 Send a message via Skype™ to gaba88
gaba88's Avatar
gaba88
Online
Forum Nokia Champion
Quote:
Originally Posted by belzi View Post
HI all,

I wana Read a Video from My Java Code on My Nokia 6131, please can some one help me.

Ziad,
hi belzi
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
Reply With Quote

#3 Old Re: How to read a video with Java Code - 2008-09-08, 21:18

Join Date: Sep 2008
Posts: 21
belzi
Offline
Registered User
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){}
			
	}

}
Regards
Ziad
Reply With Quote

#4 Old Re: How to read a video with Java Code - 2008-09-08, 21:33

Join Date: Nov 2007
Posts: 2,029
Location: Rome, Italy
Send a message via MSN to jappit Send a message via Skype™ to jappit
jappit's Avatar
jappit
Offline
Forum Nokia Champion
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


www.jappit.com - mobile and web blog
Reply With Quote

#5 Old Re: How to read a video with Java Code - 2008-09-09, 00:21

Join Date: Sep 2008
Posts: 21
belzi
Offline
Registered User
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());
			 
		 }
			
	}
Regards
Ziad
Reply With Quote

#6 Old Re: How to read a video with Java Code - 2008-09-09, 00:50

Join Date: Apr 2003
Posts: 6,408
Location: USA, CA
hartti's Avatar
hartti
Offline
Nokia Expert
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
Reply With Quote

#7 Old Re: How to read a video with Java Code - 2008-09-09, 01:03

Join Date: Sep 2008
Posts: 21
belzi
Offline
Registered User
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
Reply With Quote

#8 Old Re: How to read a video with Java Code - 2008-09-09, 01:47

Join Date: Sep 2008
Posts: 21
belzi
Offline
Registered User
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());
		 }
			
	}
Regards
ziad
Reply With Quote

#9 Old Re: How to read a video with Java Code - 2008-09-09, 15:35

Join Date: Sep 2008
Posts: 21
belzi
Offline
Registered User
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_DIRECT_VIDEO can be implemented for Canvas only.
->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
Reply With Quote

#10 Old Re: How to read a video with Java Code - 2008-09-09, 15:46

Join Date: Nov 2007
Posts: 2,029
Location: Rome, Italy
Send a message via MSN to jappit Send a message via Skype™ to jappit
jappit's Avatar
jappit
Offline
Forum Nokia Champion
You can try these:

* get and use the VolumeControl of your Player, and modify video volume with it
Code:
(VolumeControl)player.getControl("VolumeControl");
* if you're testing on a S60 phone, check if device is in Silent profile: if it is, try switching to General

Pit


www.jappit.com - mobile and web blog
Reply With Quote

#11 Old Re: How to read a video with Java Code - 2008-09-09, 16:04

Join Date: Sep 2008
Posts: 21
belzi
Offline
Registered User
HI,

I tried this, but the video still without sound.

Code:
vc = (VolumeControl)player.getControl("VolumeControl");
vc.setLevel(80);
*I'm testing on a 6131 Nokia phone.

regards
ziad
Reply With Quote

#12 Old Re: How to read a video with Java Code - 2008-09-09, 16:15

Join Date: Nov 2007
Posts: 2,029
Location: Rome, Italy
Send a message via MSN to jappit Send a message via Skype™ to jappit
jappit's Avatar
jappit
Offline
Forum Nokia Champion
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


www.jappit.com - mobile and web blog
Reply With Quote

#13 Old Re: How to read a video with Java Code - 2008-09-09, 16:31

Join Date: Sep 2008
Posts: 21
belzi
Offline
Registered User
HI,

My 6131 Nokia phone is already in General mode, and nothing happens.

ziad
Reply With Quote

#14 Old Re: How to read a video with Java Code - 2008-09-09, 18:42

Join Date: Apr 2003
Posts: 6,408
Location: USA, CA
hartti's Avatar
hartti
Offline
Nokia Expert
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
Reply With Quote

#15 Old Re: How to read a video with Java Code - 2008-09-09, 19:30

Join Date: Sep 2008
Posts: 21
belzi
Offline
Registered User
HI,

I tried all these Options and still have the same problem NO SOUND.

ziad
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
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

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomE2fforumE2fshowthreadE2ephpE3ftE3d122813X qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE44iscussionQ qdcZtypeQUqfntypeZE44iscussionContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtopicQUqfnTopicZentertainmentQ qfnZtopicQUqfnTopicZmediaQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE44iscussionQ qfnZtypeQUqfntypeZE44iscussionContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE44iscussionQ qrdfZtypeQUqfntypeZE44iscussionContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ