Manager: createPlayer(InputStream arg0, String arg1) throws IOException, MediaException : Manager « javax.microedition.media « Java by API






Manager: createPlayer(InputStream arg0, String arg1) throws IOException, MediaException

 


import javax.microedition.media.Manager;
import javax.microedition.media.Player;
import javax.microedition.midlet.MIDlet;

public class DistributedToneMIDlet extends MIDlet {

  private Player tonePlayer;
  
  public DistributedToneMIDlet() {
    try {
      tonePlayer = Manager.createPlayer(getClass().getResourceAsStream(
        "/x.jts"), "audio/x-tone-seq");
    } catch(Exception e) {
      System.err.println(e);
    }
  }
  
  public void startApp() {
    try {
      if(tonePlayer != null)
        tonePlayer.start();
    } catch(Exception e) {
      System.err.println(e);
    }
  }
  
  public void pauseApp() {
  }
  
  public void destroyApp(boolean unconditional) {
  }
}

   
  








Related examples in the same category

1.Manager.MIDI_DEVICE_LOCATOR
2.Manager.TONE_DEVICE_LOCATOR
3.Manager: getSupportedContentTypes(String protocol)
4.Manager: getSupportedProtocols(String content_type)
5.Manager: playTone(int note, int duration, int volume) throws MediaException