Discussion Board

Results 1 to 2 of 2

Thread: media player

  1. #1
    Nokia Developer Champion jitu_goldie's Avatar
    Join Date
    Sep 2008
    Location
    Noida, U.P.
    Posts
    1,330
    Hi all,
    i want to create a media player which plays the mp3 files from server. i hav only idea of it but unaware from implementation. what i have to done for this please tell me.what is the logic for it.

  2. #2
    Nokia Developer Champion raj_J2ME's Avatar
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,314
    Hi,
    You just want to play the file from server itself on your handset...right...not want to download..right
    For this you have to follow these steps,
    1.You must have the location of mp3 file...URL of the file,
    2.Open the HTTP connection against that URL,
    3.Create the player instance in order to play the file,
    4.Play the file using the player instance,

    Mark one more thing that call all the life cycle methods before you actually play the file,

    First you read these lines..very much helpful,
    http://www.devx.com/wireless/Article/20911/1954
    http://today.java.net/pub/a/today/2005/09/27/j2me4.html

    Then below is the code in order to play the file,

    public void run()
    {
    try
    {
    String url = "http://server/audio.mp3";
    HttpConnection conn = (HttpConnection)Connector.open(url,
    Connector.READ_WRITE);
    InputStream is = conn.openInputStream();
    player = Manager.createPlayer(is,"audio/mpeg");

    player.realize();
    // get volume control for player and set volume to max
    vc = (VolumeControl) player.getControl("VolumeControl");
    if(vc != null)
    {
    vc.setLevel(100);
    }
    player.prefetch();
    player.start();
    }
    catch(Exception e)
    {}
    }

    I hope these lines can help you in any means,
    Thanks
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

Similar Threads

  1. Replies: 9
    Last Post: 2012-02-10, 07:36
  2. Create 3GP player with J2ME for Mobile
    By dexxa05 in forum Mobile Java Media (Graphics & Sounds)
    Replies: 57
    Last Post: 2012-01-10, 11:44
  3. Nokia E60 - Media player problems...
    By Guntis in forum Audio
    Replies: 0
    Last Post: 2007-02-05, 23:50

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved