×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Feb 2009
    Posts
    8

    Lightbulb Create a playlist using javax.microedition.media.Player

    Hi all,
    I'm developing application using gps and multimedia on Nokia N95 8GB using J2ME Platform.

    I had to play some sound files stored into the jar (or even into the memory card).

    To play audio files, I'm using java.microedition.media.Player.

    I must to play different files one follow of the other.

    It's possible to create playlist to manage it?

    Cause if I create different MediaPlayer and put one below the other, they start together and the sound files plays one over the other. (To Avoid this I used a Thread.sleep but is not a good choice).

    Thanks in advance

  2. #2
    Nokia Developer Expert
    Join Date
    Aug 2007
    Posts
    1,595
    [URL="http://library.forum.nokia.com/java"][B] >>> Java Developer's Library <<<[/B][/URL]
    [URL="https://www.developer.nokia.com/Resources/Support/Technical_support.xhtml"] [B]>>> Technical Support for Java ME development <<<[/B][/URL]
    [URL="https://publish.ovi.com/info/"][B]>>> Nokia Publish: reach millions of Nokia users worldwide through Nokia Store <<<[/B][/URL]

  3. #3
    Registered User
    Join Date
    Feb 2009
    Posts
    8

    Re: Create a playlist using javax.microedition.media.Player

    Hi r2j7,
    thank you so much for the answer.

    I read about Player pooling and Resource management but I am unable to solve this problem:

    Suppose I create a Player's pool.

    How can I start those players one follow the other?

    And.. How can I stop the execution in any moment of all the pool players list?

    If I check the var Player.getState() I must have a daemon pooling everytime on the var... and if I stop the player,
    the following player starts the execution.

    I can even set a brake on the "for" cicle on the Player vector.

    Eg:

    Code:
    Vector players = new Vector();
    ..
    /*Filling up the vector*/
    ..
    
    for (int i = 0; i<players.size(); i++)
    {
        Player player2 = ( Player )players.elementAt(i);
        player2.start();
        while(player2.getState == p.Started)
        {
             Thread.sleep(500);
        }  
        //in this way the players starts sequentially... but how can I stop all the execution
        //of the queue in specific moment? Using a var shared by different threads? 
        //LIKE:
    
        if (sharedVar.getInstance().getStopStatus())
         break;
    }
    But on this way I wait however at least the end of a file playing.

    Any suggestion?

    Thanks
    Last edited by acalabro; 2010-05-25 at 12:13. Reason: put code tag

  4. #4
    Nokia Developer Expert
    Join Date
    Aug 2007
    Posts
    1,595

    Re: Create a playlist using javax.microedition.media.Player

    Hello acalabro,

    instead of for looping, one could use public void playerUpdate(Player p, String event, Object eventData) as described in the library chapter Java Developer's Library 3.5 > Developer's Guides > Multimedia > Creating multimedia applications > Using the Mobile Media API > Recommended practices > Player pooling for the purpose. Here is the logic:

    -associate a player listener for each player:

    Player p1;
    Player p2;
    ..
    p1.addPlayerListener(this);
    p2.addPlayerListener(this);

    //start p1


    -for playerUpdate, f.ex. if p1 has been started and p2 needs to be started immediately after p1 has finished:

    public void playerUpdate(Player p, String event, Object eventData) {

    if(p == p1 && event == PlayerListener.END_OF_MEDIA)

    {
    // start p2
    }
    ...
    }



    Regards,
    r2j7
    [URL="http://library.forum.nokia.com/java"][B] >>> Java Developer's Library <<<[/B][/URL]
    [URL="https://www.developer.nokia.com/Resources/Support/Technical_support.xhtml"] [B]>>> Technical Support for Java ME development <<<[/B][/URL]
    [URL="https://publish.ovi.com/info/"][B]>>> Nokia Publish: reach millions of Nokia users worldwide through Nokia Store <<<[/B][/URL]

  5. #5
    Registered User
    Join Date
    Feb 2009
    Posts
    8

    Re: Create a playlist using javax.microedition.media.Player

    Cool event programming,
    I like it .. and I'll try!
    Thank you so much!



    Quote Originally Posted by r2j7 View Post
    Hello acalabro,

    instead of for looping, one could use public void playerUpdate(Player p, String event, Object eventData) as described in the library chapter Java Developer's Library 3.5 > Developer's Guides > Multimedia > Creating multimedia applications > Using the Mobile Media API > Recommended practices > Player pooling for the purpose. Here is the logic:

    -associate a player listener for each player:

    Player p1;
    Player p2;
    ..
    p1.addPlayerListener(this);
    p2.addPlayerListener(this);

    //start p1


    -for playerUpdate, f.ex. if p1 has been started and p2 needs to be started immediately after p1 has finished:

    public void playerUpdate(Player p, String event, Object eventData) {

    if(p == p1 && event == PlayerListener.END_OF_MEDIA)

    {
    // start p2
    }
    ...
    }



    Regards,
    r2j7

Similar Threads

  1. Not able to create CAknIntegerEdwin/CAknNumericEdwin
    By gpalvia in forum Symbian User Interface
    Replies: 4
    Last Post: 2010-07-19, 09:22
  2. Replies: 10
    Last Post: 2007-07-02, 06:28
  3. help need...How to create a playlist in s60 platform
    By ravibabu in forum Mobile Java Media (Graphics & Sounds)
    Replies: 4
    Last Post: 2007-06-14, 06:59
  4. Steps to create SIS. How create .pkg file for petran?
    By BobbyFletcher in forum Symbian Tools & SDKs
    Replies: 1
    Last Post: 2004-04-21, 18:26
  5. how to create a grid
    By ddhungry in forum Symbian User Interface
    Replies: 0
    Last Post: 2002-11-27, 08:08

Posting Permissions

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