×

Discussion Board

Results 1 to 10 of 10
  1. #1
    Registered User
    Join Date
    Apr 2009
    Posts
    12

    replaying amr files in java me

    I noticed that setMediaTime() to 0 or -1 only works for .wav files and dosnt work for .amr and .mp3
    Do i have to close the player and create a new player if i want to re-play the music. calling player.stop then player.start starts play from the point it was stoped so i cant seem to get these file types to play from the begining. Any suggestions.

  2. #2
    Super Contributor
    Join Date
    Feb 2006
    Posts
    689

    Re: replaying amr files in java me

    Hi,
    You dont need to create another player for this.see this

    public void setLoopCount(int count)

    Set the number of times the Player will loop and play the content.

    By default, the loop count is one. That is, once started, the Player will start playing from the current media time to the end of media once.

    If the loop count is set to N where N is bigger than one, starting the Player will start playing the content from the current media time to the end of media. It will then loop back to the beginning of the content (media time zero) and play till the end of the media. The number of times it will loop to the beginning and play to the end of media will be N-1.

    Setting the loop count to 0 is invalid. An IllegalArgumentException will be thrown.

    Setting the loop count to -1 will loop and play the content indefinitely.

    If the Player is stopped before the preset loop count is reached either because stop is called, calling start again will resume the looping playback from where it was stopped until it fully reaches the preset loop count.

    An END_OF_MEDIA event will be posted every time the Player reaches the end of media. If the Player loops back to the beginning and starts playing again because it has not completed the loop count, a STARTED event will be posted.

    Parameters:
    count - indicates the number of times the content will be played. 1 is the default. 0 is invalid. -1 indicates looping indefintely.
    Throws:
    IllegalArgumentException - Thrown if the given count is invalid.
    IllegalStateException - Thrown if the Player is in the STARTED or CLOSED state.


    Thanks
    Soku
    Last edited by soku123; 2009-07-06 at 15:35. Reason: thanks

  3. #3
    Super Contributor
    Join Date
    Feb 2006
    Posts
    689

    Re: replaying amr files in java me

    Hi,
    Or else add the Player listener,Over the player update method and check for End of media event and then again start from the beginning.

    Thanks
    Soku

  4. #4
    Registered User
    Join Date
    Apr 2009
    Posts
    12

    Re: replaying amr files in java me

    Thanks for the reply. But if i stop the file playback midway, is there any way to start from the begining instead of continuing from where i stoped previously.

  5. #5
    Super Contributor
    Join Date
    Feb 2006
    Posts
    689

    Re: replaying amr files in java me

    Hi,
    You have to close the player and start from the begining.

    Thanks
    Soku

  6. #6
    Registered User
    Join Date
    Apr 2009
    Posts
    12

    Re: replaying amr files in java me

    yup. The only other option is to use a wav file (if you dont mind the bigger file size). Thanks

  7. #7
    Super Contributor
    Join Date
    Feb 2006
    Posts
    689

    Re: replaying amr files in java me

    Hi,
    What do u mean by the alternative wav file?

    Thanks
    Soku

  8. #8
    Registered User
    Join Date
    Apr 2009
    Posts
    12

    Re: replaying amr files in java me

    i mean instead of using amr files, use wav files. The setMediaTime(0) seems to work only for wav files.

  9. #9
    Super Contributor
    Join Date
    Feb 2006
    Posts
    689

    Re: replaying amr files in java me

    Hi,
    On which device r u testing.

    Thanks
    Soku

  10. #10
    Registered User
    Join Date
    Apr 2009
    Posts
    12

    Re: replaying amr files in java me

    Testing on Music Xpress 5800

Similar Threads

  1. Voice Recognition 6600: How to compare two AMR files?
    By fmartin5 in forum Mobile Java General
    Replies: 3
    Last Post: 2009-05-12, 10:21
  2. how do i convert amr files from my phone into wave files???
    By buckluster in forum Mobile Java Media (Graphics & Sounds)
    Replies: 0
    Last Post: 2006-04-24, 15:31
  3. AMR files from WebServer
    By pjericoh in forum Mobile Java General
    Replies: 0
    Last Post: 2005-05-10, 22:20
  4. AMR files from WebServer
    By pjericoh in forum Audio
    Replies: 0
    Last Post: 2005-05-10, 21:31
  5. How to play AMR files in MIDP2.0
    By Creator3D in forum Mobile Java Media (Graphics & Sounds)
    Replies: 1
    Last Post: 2005-03-17, 08:35

Posting Permissions

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