×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Registered User
    Join Date
    Nov 2010
    Posts
    47

    how can i show progress bar for mp3 player?

    hi,
    1.i just want to show progress bar as the song plays with 1 second of time. how can i do it for mp3 file.?
    i have seen one gauge bar example but i dont know if i can use it for the same or not?
    2.how can i measure the length of mp3 file in time?


    thankx.

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

    Re: how can i show progress bar for mp3 player?

    Quote Originally Posted by hitendrasinh.gohil View Post
    hi,
    1.i just want to show progress bar as the song plays with 1 second of time. how can i do it for mp3 file.?
    i have seen one gauge bar example but i dont know if i can use it for the same or not?
    2.how can i measure the length of mp3 file in time?




    thankx.
    1. You try first the same and let us know the results.


    2. /* You can get the total length in milliseconds*/
    long duration = player.getDuration();

    /* You can get the current player time in milliseconds*/
    long currentTime = player.getMediaTime();
    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
    Nov 2010
    Posts
    47

    Re: how can i show progress bar for mp3 player?

    thankx for replying,
    i will inform u.

  4. #4
    Registered User
    Join Date
    Nov 2010
    Posts
    47

    Re: how can i show progress bar for mp3 player?

    hi,
    raj its just work fine.i have set max value to duration and just set the incremental value in guage.

    thankx a lot.

  5. #5
    Registered User
    Join Date
    Dec 2010
    Posts
    39

    Re: how can i show progress bar for mp3 player?

    Hi Gohil, can u pl post the MP3 play part of your Java code;

    my app works fine for "AMR" files but it hangs at "realize" for MP3s.

  6. #6
    Registered User
    Join Date
    Nov 2010
    Posts
    47

    Re: how can i show progress bar for mp3 player?

    hi,
    what is the exception or error u r getting?
    or pls post your code here that i can check it with my device.

    thankx

  7. #7
    Registered User
    Join Date
    Dec 2010
    Posts
    39

    Re: how can i show progress bar for mp3 player?

    I gave displays before & after "realize". The display before realize is displayed but after realize doesnt come.
    The code for "AMR" and MP3 are same. (may be i dont know what to be changed for MP3).
    Here's the code snippet:


    musicIndx++;

    String curFile = playlist.getString (musicIndx);
    tmpStat ("Playing "+currDirName+curFile);
    mainScr.updStat (musicIndx + 1,playlist.size (),curFile);


    player = Manager.createPlayer("file://"+currDirName+curFile);

    player.addPlayerListener (this);

    if(player.getState() == player.UNREALIZED) {
    tmpStat ("before realize");
    player.realize ();
    tmpStat ("after realize");
    }

    if(player.getState() == player.REALIZED) {
    tmpStat ("before prefetch");
    player.prefetch ();
    tmpStat ("after prefetch");
    }



    player.start ();

    updatePlayerGauge ();

    Thread.sleep (1);
    while (playerPlaying)
    Thread.sleep (1);
    stopPlayer ();

  8. #8
    Registered User
    Join Date
    Nov 2010
    Posts
    47

    Re: how can i show progress bar for mp3 player?

    hi,

    you are getting problem from realize means that player cant get information about media sources.try to log the url that has been passed to player.

    1.first of all just try file:/// instead of file://.
    2. then just try to play the file direct from source as inputstream.
    like InputStream is=getclass().getResourceAsStream("/sample.mp3"); sample.mp3 is under res folder of your project.

    also try each code in device because sometimes the code works fine with device.

  9. #9
    Registered User
    Join Date
    Dec 2010
    Posts
    39

    Re: how can i show progress bar for mp3 player?

    Gohil,
    1. I didnt use file:/// because, my dirname begins with a slash (/). Thus the parameter becomes "file://"+"/M:/"

    2. If I put the mp3 into resource folder, I cannot install into my handset.
    May be I forgot to specify, the application works fine for MP3 via emulator (whether the MP3 is inside res or in filesystem).
    I cannot install the app if mp3 is inside res since the jar size is 3K+.
    If I put the mp3 outside res, then "realize" doesnt finish.

Similar Threads

  1. Replies: 2
    Last Post: 2010-10-25, 06:24
  2. Progress Bar for Media Player
    By somnathbanik in forum Symbian Media (Closed)
    Replies: 6
    Last Post: 2010-08-13, 09:37
  3. Progress bar in MP3 player
    By shikhakhandelwal in forum General Development Questions
    Replies: 3
    Last Post: 2008-03-19, 11:09
  4. how to show progress in playing mp3 file ?
    By serverclient2004 in forum Symbian Media (Closed)
    Replies: 0
    Last Post: 2005-07-15, 03:42

Posting Permissions

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