how to generate barcode c# code Figure 2-3. Registering a Listener with a Player in Objective-C

Creator DataMatrix in Objective-C Figure 2-3. Registering a Listener with a Player

Figure 2-3. Registering a Listener with a Player
Print DataMatrix In Objective-C
Using Barcode printer for iPhone Control to generate, create Data Matrix ECC200 image in iPhone applications.
www.OnBarcode.com
Making Code-39 In Objective-C
Using Barcode printer for iPhone Control to generate, create ANSI/AIM Code 39 image in iPhone applications.
www.OnBarcode.com
Updates are tagged as Strings, with additional information optionally provided in an accompanying Object. This flexible design allows manufacturers to define their own event types without requiring changes to the interface. MMAPI defines a broad set of standard event names and makes them available as public fields in the PlayerListener interface. You will need to add references to any RIM-specific event types in your own code. Table 2-1 shows the Player events that can be generated during media capture.
Barcode Printer In Objective-C
Using Barcode generator for iPhone Control to generate, create Barcode image in iPhone applications.
www.OnBarcode.com
Barcode Creator In Objective-C
Using Barcode printer for iPhone Control to generate, create Barcode image in iPhone applications.
www.OnBarcode.com
Download at
Code128 Encoder In Objective-C
Using Barcode maker for iPhone Control to generate, create Code 128A image in iPhone applications.
www.OnBarcode.com
DataMatrix Generator In Objective-C
Using Barcode printer for iPhone Control to generate, create ECC200 image in iPhone applications.
www.OnBarcode.com
CHAPTER 2: Media Capture
UPC-A Supplement 2 Creator In Objective-C
Using Barcode creation for iPhone Control to generate, create UPCA image in iPhone applications.
www.OnBarcode.com
GTIN - 12 Generator In Objective-C
Using Barcode encoder for iPhone Control to generate, create UPCE image in iPhone applications.
www.OnBarcode.com
Table 2-1. Player Events During Recording
Reading ECC200 In Visual Studio .NET
Using Barcode decoder for VS .NET Control to read, scan read, scan image in Visual Studio .NET applications.
www.OnBarcode.com
Recognizing DataMatrix In C#.NET
Using Barcode recognizer for .NET framework Control to read, scan read, scan image in Visual Studio .NET applications.
www.OnBarcode.com
String
UPCA Generator In Java
Using Barcode encoder for Eclipse BIRT Control to generate, create GTIN - 12 image in Eclipse BIRT applications.
www.OnBarcode.com
UCC-128 Maker In Java
Using Barcode creator for BIRT reports Control to generate, create USS-128 image in BIRT reports applications.
www.OnBarcode.com
recordError
Encode 1D Barcode In Visual Studio .NET
Using Barcode creator for ASP.NET Control to generate, create Linear Barcode image in ASP.NET applications.
www.OnBarcode.com
EAN / UCC - 13 Scanner In Visual C#.NET
Using Barcode scanner for .NET framework Control to read, scan read, scan image in .NET applications.
www.OnBarcode.com
Definition
Barcode Reader In .NET Framework
Using Barcode reader for VS .NET Control to read, scan read, scan image in Visual Studio .NET applications.
www.OnBarcode.com
GS1 - 13 Generation In VB.NET
Using Barcode encoder for VS .NET Control to generate, create GS1 - 13 image in .NET framework applications.
www.OnBarcode.com
RECORD_ERROR
Barcode Generator In None
Using Barcode printer for Font Control to generate, create Barcode image in Font applications.
www.OnBarcode.com
Creating UPC-A Supplement 5 In None
Using Barcode generation for Software Control to generate, create UPC A image in Software applications.
www.OnBarcode.com
Meaning
Print Code 128B In None
Using Barcode maker for Office Excel Control to generate, create ANSI/AIM Code 128 image in Office Excel applications.
www.OnBarcode.com
ECC200 Creator In None
Using Barcode generator for Software Control to generate, create Data Matrix ECC200 image in Software applications.
www.OnBarcode.com
EventData EventData Type Value
Detailed error message
An error occurred String while recording. Call setRecordLocation or setRecordStream on the RecordControl to try again. Long
recordStarted
RECORD_STARTED Recording has begun. RECORD_STOPPED Recording has stopped. Recording commit completed.
Time
recordStopped
Long
Time
net.rim.device.internal. N/A media.recordCommitted
Listing 2-1 implements a basic listener class that provides updates about the current status of a recording operation. However, a similar class could perform additional tasks as well, such as automatically restarting capture if an error occurs.
Listing 2-1. A Status Update PlayerListener import javax.microedition.media.*; import net.rim.device.api.ui.component.LabelField; public class RecordingListener implements PlayerListener { private LabelField status; public RecordingListener(LabelField status) { this.status = status; } public void playerUpdate(Player source, String event, Object data) { if (event.equals(PlayerListener.RECORD_STARTED)) { status.setText("Recording started..."); } else if (event.equals(PlayerListener.RECORD_STOPPED)) { status.setText("Recording stopped..."); } else if (event.equals(PlayerListener.RECORD_ERROR)) { status.setText("Uh-oh! Error:" + data);
Download at
CHAPTER 2: Media Capture
} else if (event.equals("net.rim.device.internal.media.recordCommitted")) { status.setText("Recorded data saved."); } else { status.setText(event + ":" + data);
Attach the PlayerListener to the Player, and you will start receiving updates automatically.
player.addPlayerListener(new RecordingListener(status));
Adding a PlayerListener is purely optional. Most advanced applications will want to receive these sorts of notifications so they can update the user and take other actions, but for simple operations, you ll be fine sticking with the basic Player API
Have Content, Will Travel
Once the Player is finished and your capture is complete, what s next Depending on the type of capture you re doing, you ll have access to different Control objects, each with its own mechanism for accessing the correct data. If you are taking a snapshot, you can call a synchronous method on VideoControl that will return you the bytes for that shot. If you are capturing audio, you can obtain a RecordControl object and provide it with a file name or output stream that should be used to store the data. Generally speaking, once you have finished your recording, you should get the data and then close the Player as soon as possible. This will make your application and the rest of the phone more responsive, freeing up memory and resources for other tasks.
What Else Is There
So far, everything described is part of the standard MMAPI. It is a fairly complete solution, and fortunately, RIM has implemented most of their media capabilities within this interface. In some situations, though, you may prefer to use the native RIM applications to perform capture instead of doing it all yourself. There may be advantages to this the RIM applications will be more familiar to the user and may contain more features than you will implement in your own but doing so is generally more complicated. The package net.rim.blackberry.api.invoke contains a class, Invoke, which can be used to launch a variety of native applications. For example, to start the camera, you would simply call Invoke with the proper parameters.
Invoke.invokeApplication(Invoke.APP_TYPE_CAMERA, null);
Download at
CHAPTER 2: Media Capture
The second parameter is an optional set of arguments that can be passed to the application. To launch in video record mode, use the appropriate parameter in CameraArguments.
Invoke.invokeApplication(Invoke.APP_TYPE_CAMERA, new CameraArguments(CameraArguments.ARG_VIDEO_RECORDER));
At this point, your application is backgrounded, and you will not be able to interact with the user. However, your application can monitor the filesystem for newly created files, and then use them as if they were created by your application. You ll see an example of this later in the chapter.
Creating a MediaPlayer
As noted earlier, any media operation requires both a DataSource and a Player. In practice, the Manager class is equipped to provide an appropriate DataSource for most request types, so you can request a Player by simply passing in the proper String for the type of capture you want to make. This raises a very important question: What happens if it fails On a BlackBerry device that has a built-in camera, such as a Curve 8300, it should work; but on a device without a camera, like an 8800, it will obviously fail. If you are developing for your own personal device, this isn t a problem you know its capabilities and what will work. However, if you hope to run on many different devices, you will need to be prepared to handle situations where the device doesn t support an operation. 10 provides much more detail on strategies to solve this problem. Fortunately, though, there is a clean way to determine at runtime whether the user s device can succeed. MMAPI defines a standard set of system properties, including the mediarelated properties shown in Table 2-2. By calling System.getProperty() with a given property name, you can determine what the device supports. Based on this, you can show an appropriate message to the user or disable an option entirely instead of waiting for it to fail.
Copyright © OnBarcode.com . All rights reserved.