×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    May 2010
    Posts
    8

    Talking Bufferize audio player [solved]

    I'm trying to write Media Player java Midlet using Manager::createPlayer() and Player class. I am trying to play mp3 file from memory card. But i get OutOfMemory exception. the data on small portions and to configure some futures?

    Loading a 500ko file works but a 1.6mo file throws a OutOfMemory Error.

    my code is :

    Code:
    	try {
    	    fc = (FileConnection) Connector.open("file://" + Cambrais.mp3Root+ fileName, Connector.READ);
    	    
    	    
    	    is = fc.openInputStream();
    	    //is =getClass().getResourceAsStream("file://" + Cambrais.mp3Root+ fileName);
    
    	    player = Manager.createPlayer(is, "audio/mpeg");
    	    
    	    player.realize();
    
    	    vc = (VolumeControl) player.getControl("VolumeControl");
    	    if(vc != null)
    		vc.setLevel(100);
    
    	    player.prefetch();
    
    	} catch (IOException e) {
    	    e.printStackTrace();
    	} catch (MediaException e) {
    	    e.printStackTrace();
    	}

    Does anyone know how to fix this problem?
    Last edited by kek_8; 2010-06-02 at 11:40. Reason: problem solved

  2. #2
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: Bufferize audio player

    Quote Originally Posted by kek_8 View Post
    I'm trying to write Media Player java Midlet using Manager::createPlayer() and Player class. I am trying to play mp3 file from memory card. But i get OutOfMemory exception. the data on small portions and to configure some futures?

    Loading a 500ko file works but a 1.6mo file throws a OutOfMemory Error.
    What so you mean?
    Some words are not clear in the post.
    What is the size of the file?
    Which device are you working with?
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  3. #3
    Registered User
    Join Date
    May 2010
    Posts
    8

    Re: Bufferize audio player

    Quote Originally Posted by raj_J2ME View Post
    What so you mean?
    Some words are not clear in the post.
    What is the size of the file?
    With a file with a 500ko size, my apps works perfectly.
    But with a file with a 1.6mo size, my apps throw a OutOfMemoryError

    Quote Originally Posted by raj_J2ME View Post
    Which device are you working with?
    I'm working with a nokia 6212 classic.

    Thanks

  4. #4
    Super Contributor
    Join Date
    Apr 2007
    Posts
    2,708

    Re: Bufferize audio player

    S40 devices wiil throw an outofmemory error, simply because they have a maximum of 2 megabytes of heap size...
    So when you download a 1.6 megabyte file the app will get to it maximum memory usage...
    Some S40 do support a progressive streaming functionality for specific codecs, which actually downloads chunks of data instead... This has to be set in the JAD and is called something like progressive_download:true but you should look that up in the wiki, there is an article about that...

  5. #5
    Registered User
    Join Date
    May 2010
    Posts
    8

    Re: Bufferize audio player

    Quote Originally Posted by Tiger79 View Post
    S40 devices wiil throw an outofmemory error, simply because they have a maximum of 2 megabytes of heap size...
    So when you download a 1.6 megabyte file the app will get to it maximum memory usage...
    Some S40 do support a progressive streaming functionality for specific codecs, which actually downloads chunks of data instead... This has to be set in the JAD and is called something like progressive_download:true but you should look that up in the wiki, there is an article about that...
    I dont download the file form a web server or any thing like this but from the memory card of the phone.
    Should i still add progresive_download to my jad?

  6. #6
    Registered User
    Join Date
    May 2010
    Posts
    8

    Re: Bufferize audio player

    Thank you Tiger71 and raj_J2ME for your help.

    I fixed my problem.

    If anyone have the same problem, you shuold check http://wiki.forum.nokia.com/index.ph...tOfMemoryError

    Thanks

Similar Threads

  1. Replies: 9
    Last Post: 2012-02-10, 07:36
  2. E71x video player losing audio
    By matt.nellymos in forum Mobile Java Media (Graphics & Sounds)
    Replies: 1
    Last Post: 2009-09-10, 17:30
  3. Wave Player using CMdaAudioPlayerUtility
    By deCoder in forum Symbian
    Replies: 8
    Last Post: 2008-06-11, 13:13
  4. Player p becomes null after it has started playing audio
    By sanket2612 in forum Mobile Java Media (Graphics & Sounds)
    Replies: 1
    Last Post: 2008-02-15, 19:21

Posting Permissions

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