Media Section Index | Page 2
How do you discover the set of mime types supported by your platform for the Mobile Media API?
The Manager class offers a getSupportedContentTypes() method for just such a purpose. Pass in a value of null to get the whole set returned.more
Using the Mobile Media API, how can I loop the playback of my song?
Use the setLoopCount() method of Player to playback media with looping. A value of -1 means forever. A value of 1 is the default. 0 is invalid.more
Using the Mobile Media API, how do you control the volume of what is played?
You need to get the VolumeControl object from the Player and change the volume through that:
vc = (VolumeControl) player.getControl("VolumeControl");
if(vc != null) {
vc.setVolume(50);
}
more
Using the Mobile Media API, how do you find out information like song title?
You have to get the MetaDataControl object for the associated player. There are four predefined keys that you can ask for: TITLE_KEY, DATE_KEY, COPYRIGHT_KEY, and AUTHOR_KEY, though other informat...more
Using the Mobile Media API, how do you know when a song/video is done playing?
You need to attach a PlayerListener to the Player.
Using the Mobile Media API, how do you play a media file stored in an RMS record store?
RecordStore rs = RecordStore.open("name");
byte record[] = rs.getRecord(id);
ByteArrayInputStream bais = new ByteArrayInputStream(record);
Player player = Manager.createPlayer(bais, "audio/x-wav"...more
How do I find out the list of image formats I can read or write?
To discover the installed set of readers and writers, you simply ask the ImageIO class through its getReaderFormatNames() and getWriterFormatNames() methods. You can also get the set of mime types...more
When writing a JPEG image, how do I control the compression level/quality?
You can get the default writing parameters for a specific ImageWriter through its getDefaultWriteParam() method. The method returns an ImageWriteParam object. For JPEGs, this happens to be an inst...more
How can I write a GIF image?
Patent restrictions didn't allow a GIF writer to be part of the Java platform prior to JDK 6. With the recent expiration of the Unisys patent, JDK 6 includes support.
import javax.imageio.*;
impo...more
How can I control my Tivo from Java?
There is an SDK available from Sourceforge (http://tivohme.sourceforge.net/ called the Home Media Engine (HME). This is the 'officially' supported product and allows you to add your own programs t...more
After calling the getAudioClip() method of Applet, when is the AudioClip loaded?
Until you try to play an audio clip, the AudioClip is not loaded.
How can I convert GIFs to PNGs using Java?
The Image I/O libraries added to Java 1.4 perform this for you:
File inputFile = new File(filename);
BufferedImage input = ImageIO.read(inputFile);
File outputFile = new File(outfilename);
...more
What video formats does the Java Media Framework (JMF) support?
The content formats supported in Sun's JMF 2.1.1 implementations
(latest as of the writing of this FAQ) are detailed at:
java.sun.com/products/java-media/jmf/2.1.1/formats.html
Note that the s...more
How can I save an image to disk in a standard image format?
The javax.imageio package provides this for you in Java 1.4. Previousl versions had no standard support, though you could add third party libraries to standard Java for this.
BufferedImage ou...more
Can I display a PNG image in an applet?
PNG support is not native to Java until 1.3. If you want to display it with a prior version of Java, like the 1.1 VM found in browsers, you must find support elsewhere. One such source is Jimi.
Fo...more