You Are Here:

Community: Developer Discussion Boards

#1 Old Exclamation Nokia 6630 -- javax.microedition.media.MediaException: Symbian OS error: -4 - 2005-09-05, 02:38

Join Date: Mar 2003
Posts: 316
Location: IL/USA
Send a message via AIM to earamsey Send a message via MSN to earamsey Send a message via Yahoo to earamsey Send a message via Skype™ to earamsey
earamsey
Offline
Regular Contributor
What does this error mean,
Code:
javax.microedition.media.MediaException: Symbian OS error: -4
I get it after taking 17 pictures, using getShapshot(), the exception occurs when trying to take the 18th picture; ALWAYS!!!!

This is how I setup the camera;
Code:
Thread thread = new Thread() {
	    public void run(){
		try
		{
		    player = Manager.createPlayer("capture://video");
		    player.addPlayerListener(playerListener);
		    player.realize();
		    videoControl = (VideoControl)player.getControl("VideoControl");
		    videoControl.initDisplayMode(VideoControl.USE_DIRECT_VIDEO, canvas);
		    int wh = Common.SCR_HEIGHT - Common.belowBannerY - 10 - Common.softKeyFn.getHeight();
		    videoControl.setDisplayLocation(Common.SCR_WIDTH/2 - wh/2, Common.belowBannerY + 10);
		    videoControl.setDisplaySize(wh, wh);
		    videoControl.setVisible(true);
		    player.start();
		    isPlayerOpen = true;
		}
		catch(Exception e)
		{
		    // error
		    Common.debug("Camera Exception:"+e);
		}
	    }
	};
	thread.start();
      }
This is how I take the picture;
Code:
	videoControl.setVisible(false);
	progressBar = new ProgressBar("Capturing\nImage", this);
	Runnable r = new Runnable(){
	    public void run() {
		try
		{
		    //byte[]imgData = videoControl.getSnapshot("encoding=jpeg&width=160&height=120");
		    byte[] imgData = null;
		    try
		    {
			imgData = videoControl.getSnapshot("encoding=jpeg");
		    }
		    catch(OutOfMemoryError oome)
		    {
			Common.debug("\nbefore cleanup OUT OF MEMORY:"+Runtime.getRuntime().freeMemory()+"\n");
			System.gc();try{Thread.sleep(2000);}catch(Exception e1){}
			Common.debug("\nafter cleanup OUT OF MEMORY:"+Runtime.getRuntime().freeMemory()+"\n");
		    }
		    taskOk(imgData);
		}
		catch(Exception e){
		    synchronized(this) {
			isGettingSnapshot = false;
		    }
		    taskFail(e);
		}
	    }
	};
	synchronized(this) {
	    isGettingSnapshot = true;
	}
	snapshotTask = new Task(this, r);
	new Timer().schedule(snapshotTask, Common.SNAPSHOT_PERIOD_IN_SECS);
    }
Any ideas?
Last edited by earamsey : 2005-09-05 at 02:44.
Reply With Quote

#2 Old Smile Re: Nokia 6630 -- javax.microedition.media.MediaException: Symbian OS error: -4 - 2008-05-08, 10:17

Join Date: May 2008
Posts: 1
yangjize
Offline
Registered User
hello, dingf006

my applition's error is "javax.microedition.media.mediaexception:symbian os error -5"

tell me what's mistake please.
Reply With Quote

#3 Old Smile Re: Nokia 6630 -- javax.microedition.media.MediaException: Symbian OS error: -4 - 2008-05-08, 15:37

Join Date: Mar 2003
Posts: 316
Location: IL/USA
Send a message via AIM to earamsey Send a message via MSN to earamsey Send a message via Yahoo to earamsey Send a message via Skype™ to earamsey
earamsey
Offline
Regular Contributor
check out this web site: Symbian OS Error Codes

Quote:
KErrNotSupported -5 The operation requested is not supported
Thanks


Erica A Ramsey / Mobile Apps Developer /
Resume ~ http://home.comcast.net/~erica.ramsey/CV
Some Project Screenshots ~ http://home.comcast.net/~erica.ramsey/CV/screens.html
Last edited by earamsey : 2008-05-08 at 16:26.
Reply With Quote

#4 Old Re: Nokia 6630 -- javax.microedition.media.MediaException: Symbian OS error: -4 - 2008-05-08, 15:45

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 yangjize,

as stated on the document linked by earamsey, -5 error means that the operation is not supported. Which device or emulator is giving you that error? If you can, try also posting the code that is throwing that Exception.

Pit


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

#5 Old Re: Nokia 6630 -- javax.microedition.media.MediaException: Symbian OS error: -4 - 2008-05-09, 01:09

Join Date: Dec 2004
Posts: 184
shaii
Offline
Regular Contributor
earamsey: i like the fact that you can help yangjize in your post by showing him symbian error codes and not look up ur own error code ;)

KErrNoMemory -4 "Not enough memory. Close some applications and try again"
after 17 pictures your out of memory buddy ;)

since you havent posted your full code i cant tell you exactly why you out of memory but i suspect that in the method "taskOk" you aggrigate the image data you recieved from the camera so .... dont do that ;) save to disk or somthing like that

BR
Reply With Quote

#6 Old Re: Nokia 6630 -- javax.microedition.media.MediaException: Symbian OS error: -4 - 2008-05-09, 01:44

Join Date: Mar 2003
Posts: 316
Location: IL/USA
Send a message via AIM to earamsey Send a message via MSN to earamsey Send a message via Yahoo to earamsey Send a message via Skype™ to earamsey
earamsey
Offline
Regular Contributor
yes, if I recall, I was writing images to RMS. I don't think I collected them item into a array of 17 images, ie, Image[17]. I think that Nokia has some kind of bug in it with Canvas because I did display each image on Canvas after it was taken.

I think I traced the bug to someplace else though I don't quite remember this project. I remember creating my own widget library; I was using something called synclastui but after studying it's source code I decided to create my own less resource hungry version.

I think that Nokia JVM needs a little more work on it. I Also had application that parsed larges amounts of XML, possible up to at least 1MB maybe more -- download from a server. Here I traced one of the problems there to kXML. It generates a new String everytime you call method to get an XML attribute, namespace, text, tag name and since there is potential of 10MB data many strings were getting creating during parse.

I rewrote kXML to use char[] instead of calling new String().
Code:
private char [] chbuffer;
Instead of getText() return string it returns offset of Text inside of chbuffer array. The format of Strings inside of chbuffer are;
Code:
struct {
    byte [4] length;
    byte [length] data;
}
Now All I return is an Integer and chbuffer is reused and can grow as needed; I grew it in 128K byte chunks. It worked pretty good. This was a different project though and it ran on Nokia E61.

I've decided to create a kXML replacement that works on above principal but it will use char[] instead of byte because for display I had to convert byte to char anyways. And I will write a WSDL command line tool that will generate Java code snippits from WSDL. I wish I had this when I wrote a previous project that communicated with .NET Web Services via SOAP. It was repetitive coding all of those kSOAP methods by hand.

I don't use "javax.sax" because it is event driven and it is not standard across j2me implimentations and leads to source code fragmentation.

I think i'll make xml parser/wsdl tools GPL of course, I could use the cash if someone it was sellable but I don't think developers buy j2me libraries... I don't. Except for Barcode scanner library but my last client purchased that not I.

My next project will be DICOM viewer, maybe I can sell that to users since I will try to do it using J2ME; if this is possible.

Well, thanks for help but that original post has long been over :D

Bye!


Erica A Ramsey / Mobile Apps Developer /
Resume ~ http://home.comcast.net/~erica.ramsey/CV
Some Project Screenshots ~ http://home.comcast.net/~erica.ramsey/CV/screens.html
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 Off
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
AMR tp PCM using CMMFCodec on Symbian 8.0 (6630) stew_mclean Symbian Media (Graphics & Sounds) 2 2005-12-15 06:53
Current Symbian Development Opportunities...!! mobile2004 General Symbian C++ 0 2005-01-17 18:58
Global Symbian Development Opportunities *High Importance* sara.lindsay General Symbian C++ 0 2004-05-21 12:16
Global Symbian Development Opportunities *High Importance* sara.lindsay General Symbian C++ 2 2004-05-08 10:09
Global Symbian Development Opportunities *High Importance* sara.lindsay General Symbian C++ 0 2004-05-07 12:45

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: qdcZidentifierQSxhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomE2fforumE2fshowthreadE2ephpE3ftE3d18645X qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE44iscussionQ qdcZtypeQUqfntypeZE44iscussionContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtopicQUqfnTopicZentertainmentQ qfnZtopicQUqfnTopicZj2meQ qfnZtopicQUqfnTopicZjavaQ qfnZtopicQUqfnTopicZmediaQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE44iscussionQ qfnZtypeQUqfntypeZE44iscussionContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE44iscussionQ qrdfZtypeQUqfntypeZE44iscussionContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ