ebooksgratis.com

See also ebooksgratis.com: no banners, no cookies, totally FREE.

CLASSICISTRANIERI HOME PAGE - YOUTUBE CHANNEL
Privacy Policy Cookie Policy Terms and Conditions
Java Mobile Media API - Wikipedia, the free encyclopedia

Java Mobile Media API

From Wikipedia, the free encyclopedia

The Mobile Media API (MMAPI) is an API specification for the Java ME platform CDC and CLDC devices such as mobile phones. Depending on how it's implemented, the APIs allow applications to play and record sounds and video, and to capture still images. MMAPI was developed under the Java Community Process as JSR 135.

Contents

[edit] Programming concepts

The Multimedia Java API is based around four main types of classes in the javax.microedition.media package—the Manager, the Player, the PlayerListener and various types of Control.

Java ME programmers wishing to use JSR 135 would first make use of the static methods of the Manager class. Although there are other methods such as playTone, the main method used is createPlayer. This takes either a URI or an InputStream, and optionally a MIME type. In most cases, URIs are used. Common URI protocols used include:

  • file:
  • resource: (which may extract a file from within the JAR of the MIDlet, but is implementation-dependent)
  • http:
  • rtsp:
  • capture: (used for recording audio or video)

The MIME type is optional, and is inferred from the data passed in if not supplied.

The createPlayer method returns an implementation of the Player interface (even if you use a capture: protocol URI). This has core methods that are applicable to all players, such as starting and stopping the media, and requesting that it loop. You can also setPlayerListener to an object implementing the PlayerListener interface, which will receive various events related to the clip (starting, stopping, media finishing, etc.)

Player classes also have a getControl method that returns an implementation of a particular Control. A Control handles any optional APIs which are not applicable to all media types. Any given Player may or may not be able to supply an implementation of any given Control.

(Typically, the Control returned is actually the Player itself, but this is not guaranteed to be the case.)

The set of controls implemented by a Player is not limited; however, some standard ones are defined in the javax.microedition.media.control package by the JSR:

RateControl for setting the speed of a clip
MetaDataControl for accessing metadata about a clip, for example ID3 tags
FramePositioningControl for setting a video clip location based on frames rather than time
StopTimeControl for asking a clip to stop at a given time
RecordControl to specify how you wish to record using a capture: URI, and for taking snapshots
ToneControl for note-based formats such as MIDI, specifying the tone
PitchControl for note-based formats, specifying the pitch
MIDIControl for MIDI-specific functions such as bank queries
VideoControl for specifying where on the screen video might play

(Others may be defined in JSR 234 (Advanced Multimedia Supplements).

A subset of JSR 135 is defined in JSR 118 (MIDP 2.0).

[edit] Implementations

As with most Java ME specifications, implementations differ despite the best efforts of the specification authors to ensure consistency. Two obvious areas for differences are in the controls supported, and in the acceptable URI types in the first place. More obscure areas are whether mixing is supported; many games would like to play a MIDI music track and layer PCM sound effects on top.

Another source of extreme variance is in performance. For example, if an HTTP clip is requested, at what point does the clip get downloaded? The specification recognises this by providing two Player methods that can be called in advance of actually playing: realize and prefetch. Depending on the implementation, these may do some of the work of getting the clip into a playable state, thus making it quicker to actually play the clip when it is needed. Some implementations are sophisticated enough to actually stream a clip on request whilst it is being played.

Symbian OS contains a very complete implementation of JSR 135, but even this is highly dependent on the underlying multimedia capabilities of the device, and some device manufacturers may choose not to expose the more obscure parts of Java ME such as recording.

Implementation consistency is ensured by forcing all implementations to pass the Java Technology Compatibility Kit (TCK). This ensures that each supported URI schema, MIME type and Control is tested, but does not test every permutation of these optional parts.

[edit] Code example

import javax.microedition.media.*;

Player p = Manager.createPlayer("http://www.fishy.com/my.mp3");
p.start();

[edit] External links

Languages


aa - ab - af - ak - als - am - an - ang - ar - arc - as - ast - av - ay - az - ba - bar - bat_smg - bcl - be - be_x_old - bg - bh - bi - bm - bn - bo - bpy - br - bs - bug - bxr - ca - cbk_zam - cdo - ce - ceb - ch - cho - chr - chy - co - cr - crh - cs - csb - cu - cv - cy - da - de - diq - dsb - dv - dz - ee - el - eml - en - eo - es - et - eu - ext - fa - ff - fi - fiu_vro - fj - fo - fr - frp - fur - fy - ga - gan - gd - gl - glk - gn - got - gu - gv - ha - hak - haw - he - hi - hif - ho - hr - hsb - ht - hu - hy - hz - ia - id - ie - ig - ii - ik - ilo - io - is - it - iu - ja - jbo - jv - ka - kaa - kab - kg - ki - kj - kk - kl - km - kn - ko - kr - ks - ksh - ku - kv - kw - ky - la - lad - lb - lbe - lg - li - lij - lmo - ln - lo - lt - lv - map_bms - mdf - mg - mh - mi - mk - ml - mn - mo - mr - mt - mus - my - myv - mzn - na - nah - nap - nds - nds_nl - ne - new - ng - nl - nn - no - nov - nrm - nv - ny - oc - om - or - os - pa - pag - pam - pap - pdc - pi - pih - pl - pms - ps - pt - qu - quality - rm - rmy - rn - ro - roa_rup - roa_tara - ru - rw - sa - sah - sc - scn - sco - sd - se - sg - sh - si - simple - sk - sl - sm - sn - so - sr - srn - ss - st - stq - su - sv - sw - szl - ta - te - tet - tg - th - ti - tk - tl - tlh - tn - to - tpi - tr - ts - tt - tum - tw - ty - udm - ug - uk - ur - uz - ve - vec - vi - vls - vo - wa - war - wo - wuu - xal - xh - yi - yo - za - zea - zh - zh_classical - zh_min_nan - zh_yue - zu -