Mobile Media API Section Index | Page 2
How do I find out what content types are support for my platform?
The Manager class has a getSupportedContentTypes() method. Passing in null will return all the supported content types across all protocols. Passing in a specific protocol will report the content ...more
How do you set the location to store captured (recorded) data?
To set the destination location for a recording operation, the RecordControl offers a setRecordLocation() which you provide a URI string to.
What protocol is used in the URI to get a player for streaming media?
RTSP is a public standard for streaming media. The locator syntax for
specifying RTSP sessions is:
"rtsp://" address [ ":" port ] [ "/" type ]
How do I play a MIDI file using the Mobile Media API (MMAPI)?
Player player = Manager.createPlayer("http://example.com/example.midi");
player.start();
Is it possible to adjust the tempo when playing back a MIDI file using the Mobile Media API?
That would be with the TempoControl. Get it from the Player and call the setTempo() method, passing in a value for the number of milli-beats per minute.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 generate a tone?
The Manager has a static playTone() method to generate tones. You can also create a Manager.TONE_DEVICE_LOCATOR player object with Player player = Manager.createPlayer(Manager.TONE_DEVICE_LOCATOR)...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
Using the Mobile Media API, how do you play a sound file that comes in the JAR?
You need to know the mime type of the audio file and pass it as a stream to the Player object.
InputStream is = getClass().getResourceAsStream("/example.wav");
Player player = Manager.createPlaye...more
Using the Mobile Media API, how do you play a video?
This is similar to playing an audio file but requires you to get the control to display the video on. You need to see the results, not just hear them.
InputStream is = getClass().getResourceAsStr...more
Using the Mobile Media API, how do you take a picture?
Use the locator string of "capture://video" to create the Player, then get the VideoControl for the viewfinder, and finally VideoControl.getSnapshot(String type) to take the picture.