| |
MMADemo Application and MediaControlSkin
Java™ 2 Platform, Micro Edition, Wireless Toolkit
Version 2.1
December 2003
|
| |
About the mmademo and the MediaControlSkin
Of the multimedia demo applications provided, the Simple Player and Video
applications demonstrate the full extent of the MMAPI features. This appendix
describes these two demo applications and the MediaControlSkin provided by
the J2METM Wireless Toolkit that contains audio and playback controls
to use on the mmademo demo programs.
Simple Player
The SimplePlayer demo application demonstrates the range of audio and
video capabilities of the MMAPI. Simple Player consists of an HTTP and Record
Management System (RMS) directory browser, a player, and a customized ring
tone parser.
The HTTP browser lets you browse HTTP directories. To make SimplePlayer's
browser treat the URL as a directory, you need to include a slash at the
end of the URL address. Selecting a media file opens it in SimplePlayer.
You can also download HTTP files and save them to an storage directory of
your choosing.
The player portion uses a generic javax.microedition.media.Player
interface. The player displays duration, media time, and controls for running
the media file. If metadata is available in a file, the player enables you
to view the information, such as author and title. In the case of MIDI files,
if karaoke text is present in the file, it displays on the screen during
play. Graphical user interface controls can be viewed on the display screen
if applicable. You can access these controls, by selecting one of the media
samples in SimplePlayer, then pressing the Menu button to view and select
the desired command.
In addition, SimplePlayer parses ring tones in Ringing Tones text transfer
language (RTTTL). See http://www.convertyourtone.com/rtttl.html
for information on RTTTL.
For a list of MMAPI-specific audio and video controls available on the
emulator's keypad, see TABLE 4.
The demo includes the following media samples:
- Bong. Plays a short WAV file. You can adjust certain playback
features, for a list of features, see TABLE 1.
The display shows the duration of the tone in minutes:seconds:tenths of a
second, for example 00:17:5. This WAV file is accessed from a JAR file.
- MIDI Scale. Plays two renditions of the musical scale, first
rendition is a series of tones and the second is a series of synthetic tones.
The display shows the title of the music selection, the duration of the audio,
the elapsed time during execution, and the bpm of execution. By pressing
the left or right selection arrows during playback, you can alter the pitch.
This MIDI file is accessed from a JAR file.
- Simple Ring Tone. Plays a short sequence of Beethoven's Ninth
Symphony. The display shows the title of the music selection, the duration
of the audio, the elapsed time in seconds and fractions of a second during
execution, and the beats per minute (bpm) of execution. By pressing the
left or right selection arrows during playback, you can alter the pitch.
This MIDI file is accessed from a JAR file.
- JavaONE Theme. Plays a brief audio file. The display shows
the title of the music selection, the duration of the audio the elapsed
time during execution, and the bpm of execution. This WAV file is accessed
from an HTTP site. This application requires an internet connection.
- MIDI Scale. Same as the previous MIDI Scale demo, however,
the audio file is accessed from an HTTP site. This application requires
an internet connection.
- Sun Behind Video. Shows a short video. The application demonstrates
video controls and playback features. This application requires an internet
connection.
- Browse RMS. Lets you select and play a previously saved audio
or video file from an RMS directory.
- Audio Capture from a default device. Lets you capture audio
from a radio or other device. The sound is captured and played back, so
you hear the initial sound followed by the playback of the sound after a
brief latency.
- [enter URL]. Plays back audio and video files from the Internet.
Type a valid URL at the insertion point and click OK to play a WAV, MIDI,
or MPEG-1 file. This application requires an internet connection. If opening
an HTTP directory from which to select a media, be sure to add a slash to
the end of the URL address.
A key feature of SimplePlayer is the implementation of keypad functions
for non-video media. The following table shows which controls are available
in the SimplePlay for various media types (WAV, MIDI, or MPEG-1 files).
Go to http://java.sun.com/products/mmapi/index.html
to see how these controls are implemented by examining the classes associated
with the controls in the Mobile Media API.
TABLE 1. Audio and Video Controls for SimplePlayer Applications
| Keypad Commands |
Video |
WAV
PCM |
MIDI/
Ring Tone |
Class |
| Mute/Unmute |
Sometimes |
Always |
Always |
VolumeControl |
| Volume |
Sometimes |
Always |
Always |
VolumeControl |
| META data |
Sometimes |
Sometimes |
Sometimes |
MetaDataControl |
| Stop in 5 seconds |
Always |
Always |
Always |
StopTimeControl/td> |
| Rate |
Always |
Never |
Always |
RateControl |
| Tempo |
Never |
Never |
Always |
TempoControl |
| Pitch |
Never |
Never |
Always |
PitchControl |
| Start/Stop Recording |
Never |
Always |
Never |
RecordControl |
| Full Screen |
Always |
Never |
Never |
VideoControl |
| Frame Forward/Backward |
Always |
Never |
Never |
FramePositioningControl |
| Play/Stop |
Always |
Always |
Always |
Player |
| Loopmode |
Always |
Always |
Always |
Player |
| Skip Forward/Backward |
Always |
Always |
Always |
Player |
| Rewind |
Always |
Always |
Always |
Player |
The following table defines the menu commands available with the SimplePlayer
demo:
TABLE 2. SimplePlayer Menu Commands
| Commands |
Definitions |
| Mute |
Turns off sound but the file continues to execute. This command toggles
to Unmute. |
| Volume |
Increases or decreases loudness. |
| META Data |
Displays information provided by the media file such as, copyright
information, the title of the audio piece, and a track list. |
| Stop in 5 seconds |
Pauses the audio play in five seconds when set during execution. |
| Rate |
Alters the rate of speed of playback. |
| Tempo
|
Increases or decreases the tempo of the tone sequence or MIDI file. |
| Pitch |
Lowers or raises the notes in a MIDI file. |
| Start/Stop Recording |
Records the audio playback. A file is created containing the recorded
audio in the directory in which the emulator is running. If you do not specify
a filename, a file called recording.wav is created. This command
toggles to Stop Recording. |
| Full Screen |
Displays a video in the full screen display area. |
| Frame Forward/Backward |
Jumps forward or backward one frame at a time in a video file. |
| Play/Stop |
Starts or stops the program. |
| Loopmode
|
Plays back the audio file immediately after
completion of play. Running Loopmode once plays the audio file once. Pressing
a second time plays the file three times. Pressing a third time plays the
file repeatedly. Pressing a fourth time returns to single play.
|
| Skip Forward/Back
|
Skips forward or backward five percent of
the duration of the media file. The sound track syncs to the video.
|
| Rewind |
Returns to the start time of the audio playback. |
Video
The Video demo application shows a stream of random scenes with background
music demonstrating the synchronization of both an audio player and a video
player. The Video demo can be viewed in a Form or Canvas. Choosing the Form
option runs the video in the screen display area. Choosing the Canvas option
runs the video in a canvas in the screen display area. Both versions of the
Video demo are accessed through an internet connection. If you are running
the Video demo from behind a firewall, remember to set your proxy server
and port.
When you choose the Form option, information about the video is shown
above the video display. The information given includes the current status
of the video (Playing or Paused), the rate of play, the volume level of the
audio being played, and the frame position.
Notice that when running the Video demo, one of the soft buttons is
labeled Snapshot. Pressing this button while the video is running, captures
a frame of the video at the instant the button is pressed. If you are running
Video with the Canvas option, the snapshot momentarily replaces the video
in the screen display area. If you are running Video with the Form option,
the snapshot is placed immediately below the video. Successive snapshots
are stacked in order below the first snapshot.
MMAPI Supported Formats
MMAPI supported formats in the J2ME Wirless Toolkit are:
- Audio (same for full and Audio Building Block): PCM and WAV audio of
all types.
- MIDI: Type 0, Type 1 MIDI, and SP-MIDI
- Video (full only): MPEG-1
- Audio Capture: Audio capture supported formats cannot be queried using
the API. Supported parameters depends on the platform and sound card, but
typical formats that work on the different platforms are:
- Microsoft Windows 2000 operating environment:
8000 Hz, 11025 Hz, 22050 Hz, 44100 Hz, and 48000 Hz
8-bit/Unsigned, 16-bit/Signed/LittleEndian - Other combinations may
not work
Mono and Stereo
- SolarisTM operating environment:
8000 Hz, 11025 Hz, 22050 Hz, 44100 Hz, and 48000 Hz
16-bit/Signed/LittleEndian - Other combinations may not work
Mono and Stereo
- Linux operating environment:
8000 Hz, 11025 Hz, 22050 Hz, 44100 Hz, and 48000 Hz
16-bit/Signed/LittleEndian - Other combinations may not work
Mono and Stereo
Limitations on Using the MMAPI in the Wireless Toolkit
- Only one MIDI or Tone Sequence player can be in use at any time. Creating
multiple MIDI and Tone sequence players is possible. But only one MIDI player
can be realized. Realizing a second MIDI player or Tone sequence player will
get a MediaException.
- For Single Tone, any number of simultaneous playTone calls is supported.
At least 4 simultaneous playTone calls is guaranteed to work. The playTone
calls can be made while a midi or tone sequence player is playing.
- The number of video players is limited by the amount of heap size
(-heapsize) allocated. Roughly, 4 concurrent http playbacks
can be run with 500KB of heap.
- The number of WAV audio Players is limited by the amount of heap
space allocated. Mixing is supported for up to 10 Players on some
machines. In any case, when the limit is reached, prefetching throws
a MediaException.
- Only one audio capturer can be in use at one time. Connecting a
second audio capturer fails with a MediaException.
- Supports only up to 4 simultaneous opened HTTP connections (MIDP's
limitation).
Attributes for mmademo
The mmademo applications has the following attributes that you can modify
in the User Defined panel of the Project Settings dialog box:
TABLE 3. Descriptions of MMAPI-specific MIDlet Attributes
| Attribute |
Description |
Attribute File |
| Player-<n> |
Name of the nth media title to be played back by the SimplePlayer
MIDlet. |
JAD |
| PlayerURL-<n> |
Location of the nth media title, playerTitle-<n>
to be played back by the SimplePlayer MIDlet. |
JAD |
| VideoTest-<n> |
The name of the nth media title to be played back by the VideoTest
MIDlet. |
JAD |
| VideoTest>-URL<n> |
Location of the nth media title, playerTitle-<n>
to be played back by the VideoTest MIDlet. |
JAD |
MediaControlSkin
A special skin is provided by the Wireless Toolkit that contains audio
and video playback controls that you can use to modify and test the features
in the mmademo. Playback control buttons for sound and video are
described in the following table:
Table 4. Audio and Video Playback Controls on MediaControlSkin
Keypad
| Keypad Buttons |
Function |
| 1/Reverse |
Stops video and reverses approximately 10% and resumes play. |
| 2/Play-Pause |
Press once to pause video, press again to resume play. |
| 3/Forward |
Stops video and advances approximately 10% and resumes play. |
| 4/Slow |
Slows play of video incrementally as you hold button down. |
| 5/Stop |
Stops video playback. |
| 6/Speed Up |
Increase speed of video play incrementally as you hold button down. |
| 7/Go Back |
Goes back one frame during play. |
| 8/Full Screen |
Toggles to fill entire display area or reduce area of video display.
Note that switching screen size modes causes flashing. |
| 9/Go Forward |
Advances video one frame during play. |
| */Decrease Volume |
Lowers audio volume. |
| 0/>Mute |
Mutes audio. |
| #/Increase Volume |
Increases audio volume. |
Buttons are active relative to the type of application running. For instance,
if a .wav file is running, the buttons controlling video are inactive.
Similarly, the soft button labels are relative to the type of application
running. For instance, if a video is running, the label Snapshot is displayed.
Snapshot captures a frame in the video at the instant the button is depressed.
Note that buttons implemented for video media might be implemented by a user
program such as MediaPlayer.
The MediaControlSkin device, contains the following features:
- Tone and Tone Sequencing. Supports single or multiple tones
and tone sequencing. If you are creating a MIDlet application that incorporates
sound, the MediaControlSkin device can generate tones given the
note, duration, and volume that you specify.
- MIDI support. Enables you to playback standard MIDI files
and provides you with direct control of the MIDI device.
- WAV playback. Enables you to control the playback of audio
files in WAV format.
- WAV recording to file or stream. Enables you to record audio
files in WAV format to a specific file or stream.
- PCM audio capture and playback. Enables you to capture audio
files in PCM format and to control the playback.
- MPEG-1 video playback with audio. Enables you to view MPEG-1
videos. The MediaControlSkin emulator's keypad contains keypad buttons
for controlling audio and video operations.
Copyright © 2003
Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.