Creating a BlackBerry device application that plays media
You can create a BlackBerry® device application that plays media in the BlackBerry® Browser or in the Media application on a BlackBerry device. A BlackBerry device media application can also be created to play audio, video, and binary SVG content. A BlackBerry device application can also be created to record audio and video, and send audio to a Bluetooth® enabled headset.
The Content Handler API, is also used to provide an execution model for remotely invoking non-core BlackBerry device applications. CHAPI is an ideal mechanism for setting invocation parameters for non-core BlackBerry device applications. Using CHAPI, you can invoke applications by providing either a URL, content type, or content ID when using one of the constructors available in javax.microedition.content.Invocation class.
You can create a BlackBerry device application to play media that uses the Player interface and the javax.microedition.media package. The Player interface has been implemented by RIM. It provides the methods needed to manage the different states of a BlackBerry device application that plays media and control the playback of media files.A Player object is first constructed in an UNREALIZED state. While in this state the object is incapable of doing anything for lack of information and resources.
Invoking realize() will move the Player into a REALIZED state. This enables the Player to locate information to get the basic resources to play a media file.
Invoking prefetch() will move the Player into a PREFETCHED state. In this state the Player obtains necessary resources, and then “fetches” some of the media file to immediately start playback as soon as the Player has been started.
Invoking start() will move the Player into a STARTED start where the Player starts immediate playback of media.
It is possible to invoke start() without invoking realize() and prefetch(). The start() method will invoke prefetch
(0), which invokes realize() before media playback can be started. The simplicity of using start() in this manner may be offset through increased delays starting media playback.
Create a BlackBerry device application that plays media
- Import the required classes.
import javax.microedition.media.Manager;and more... click this link to get more explanation