×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Registered User
    Join Date
    Jun 2003
    Posts
    14

    sound could not be play again, help!!

    I stop a sound using stop();
    and after that , I call deallocate(); to deallocate the player.

    and if I need to play this sound again, I use the following codes:
    m_sound[ID].realize();
    m_sound[ID].prefetch();
    m_sound[ID].setLoopCount(1);
    m_sound[ID].start();

    but the sound do not played.

    why?

    anyone could help me!!!

    thanks!

  2. #2
    Nokia Developer Expert
    Join Date
    Jul 2003
    Posts
    46
    I don't know if this helps but try if setting media time to 0 will do any good.

  3. #3
    Registered User
    Join Date
    Jun 2003
    Posts
    14
    hello,
    I have set the media time to 0. but the problem still occur.

  4. #4
    Registered User
    Join Date
    Nov 2004
    Posts
    8
    For debugging purposes, try calling m_sound[ID].getState() and see what value comes back. This has helped me in the past.

    From the javadocs for class Player:

    Value 100 is assigned to UNREALIZED.
    Value 200 is assigned to REALIZED.
    Value 300 is assigned to PREFETCHED.
    Value 400 is assigned to STARTED.
    Value 0 is assigned to CLOSED.


    Once you figure out what state it is in, you''ll know exactly what you need to do to get it back into a playable state.

    Also, try displaying some exception information in your catch clauses; there could be problems there.

    Good luck.

  5. #5
    Nokia Developer Expert
    Join Date
    Jul 2003
    Posts
    46
    Other thing came to my mind. You don't try to play more than one player at a time, do you?

  6. #6
    Registered User
    Join Date
    Jun 2003
    Posts
    14
    hello,

    I have see the value before I call start() function. It is REALIZED.

    and I do not play more than one player at a time.

  7. #7
    Registered User
    Join Date
    Nov 2004
    Posts
    8
    Let's see, from the docs again:

    UNREALIZED --- realize( ) ---> REALIZED --- prefetch( ) ---> PREFETCHED --- start( )

    So, if it's in the REALIZED state, you can't just call start(); it's in the wrong state. You have to first call prefetch( ). That should get it into the PREFETCHED state...and *then* you can call start().

    Again, for debugging purposes, call m_sound[ID].getState() after you call prefetch() to confirm that it's in the PREFETCHED state. Once you're sure that it's in the PREFETCHED state, you should be able to call start() and it should play.

  8. #8
    Registered User
    Join Date
    Jun 2003
    Posts
    14
    the start() function will automatically call prefetch().
    I call prefetch before call start, and still no sounds.

  9. #9
    Registered User
    Join Date
    Nov 2004
    Posts
    8
    hmmm, sorry, i can't think of anything else right now...it's time for bed.

    one last question: are you displaying exception info when you call start()? I always do this:

    try {
    playPlayer.start( );
    }
    catch ( MediaException me ) {
    _debug( "MediaException: " + me );
    }

    That way, I get to see the problems if there are any.

Posting Permissions

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