Two Laptop Bag*
The moose likes Product and Other Certifications and the fly likes unable to playback .mp3 file in WTK Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Product and Other Certifications
Bookmark "unable to playback .mp3 file in WTK" Watch "unable to playback .mp3 file in WTK" New topic
Author

unable to playback .mp3 file in WTK

chetan dhewal
Ranch Hand

Joined: Nov 07, 2000
Posts: 61
I am trying to play the mp3 file in WTK 2.1... I am unable to do so. I am able to play only the .wav and .midi files.
I am using only the media API in the MIDP , i m not using the MM API.

heres the code
------------------------------

public class m4 extends MIDlet
{
public m4()
{
}


public void startApp()
{
try
{

InputStream is=getClass().getResourceAsStream("a.mp3");
Player p = Manager.createPlayer(is,"audio/mpeg");
p.realize();
p.prefetch();
p.start();

}
catch(Exception e)
{
}

}

public void pauseApp()
{
}

public void destroyApp(boolean x)
{
}

}
------------------------------


Thnx
Chetan Dhewal
SCJP 1.2


Chetan Dhewal<br />SCMAD,SCJP 1.2
Theodore Casser
Ranch Hand

Joined: Mar 14, 2001
Posts: 1902

You're asking in the wrong forum - you really should look at the J2ME forum higher up in the listing.


Theodore Jonathan Casser
SCJP/SCSNI/SCBCD/SCWCD/SCDJWS/SCMAD/SCEA/MCTS/MCPD... and so many more letters than you can shake a stick at!
Sathya Srinivasan
Ranch Hand

Joined: Jan 29, 2002
Posts: 379
If I remember right, default MIDP API supports only tones and MIDI. If you need to play MP3, you need to have the appropriate Java codec to play it. You'll probably have to initialize it using Player or Manager classes. There is no out-of-the-box support for MP3 in MIDP.


Cheers, Sathya Srinivasan - SCJP 1.2, SCWCD 1.2, SCMAD 1.0
Co-Author of Whizlabs SCMAD Certification Exam Simulator and SCMAD Exam Guide Book
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: unable to playback .mp3 file in WTK
 
Similar Threads
JLayerME-CLDC 2.0
Radio Player
unable to playback .mp3 file in WTK.
problem with JMF on Linux
Play MP3 in jar file