Core Java| JSP| Servlets| XML| EJB| JEE5| Web Services| J2ME| Glossary| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
Player Class in J2ME 
 

In J2ME, player class is used to play the .wav music, that is the only reason of using the class in our small application to create multimedia sounds.

 

Player Class in J2ME

                         

Creating Multimedia Sound Using Player Class

In J2ME, player class is used to play the .wav music, that is the only reason of using the class in our small application to create multimedia sounds. It's required to import the javax.microedition.media package to use this class in our example. 

Please find the given methods and manager class that is used to create any multimedia sounds in J2ME..

Methods:

  • addPlayerListener(PlayerListener playerListener)
  • close()
  • deallocate()
  • getContentType()
  • getDuration()
  • getMediaTime()
  • getState()
  • prefetch()
  • realize()
  • removePlayerListener(PlayerListener playerListener)
  • setLoopCount(int count)
  • setMediaTime(long now)
  • start()
  • stop()

And the Manager class, that is having following Methods:

  • createPlayer(InputStream stream, String type)
  • createPlayer(String locator)
  • getSupportedContentTypes(String protocol)
  • getSupportedProtocols(String content_type)
  • playTone(int note, int duration, int volume)

Source Code of MultimediaSound.java

import javax.microedition.midlet.MIDlet;
import javax.microedition.media.*;

public class MultimediaSound extends MIDlet {
  public void startApp(){
    try {
      Player player = Manager.createPlayer(getClass().

      getResourceAsStream("/CatBird.wav"),"audio/x-wav");


      player.start();
    catch(Exception e) {
      e.printStackTrace();
    }
  }

  public void pauseApp() {}

  public void destroyApp(boolean unconditional) {}
}

Download Source Code

                         

» View all related tutorials
Related Tags: c j2me diff types type if example to rectangle draw exam raw angle e il pe in different m nt

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

1 comments so far (
post your own) View All Comments Latest 10 Comments:

out of memory exception

Posted by ss on Friday, 12.19.08 @ 04:28am | #82964

Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.