We often use the features provided by MMAPI to play video or take pictures, and you may want to draw some menus or graphics on the canvas. This article describes how to complete the above features on a SonyEricsson model.
On the SonyEricsson JP7 model, it is easy to implement the above features. You only need to specify some specific parameters when initializing the Videocontrol. For example
Videocontrol.initdisplaymode (Videocontrol.use_direct_video | (Overlay << 8) | (Sprite.trans_rot90 << 4), canvas);
When the overlay=1 represents the drawing of the graphic overlay on the video, overlay=0 when the representative does not cover.
For JP6 or previous versions, there are a few tips to use if you want to achieve this effect. First of all, we're initializing Videocontrol,
Videocontrol.initdisplaymode (Videocontrol.use_direct_video, canvas);
The key to the problem is the processing of the paint method of canvas, in order to avoid the rendering of the content is covered we have to wait for the player to start and then draw our content, to achieve this can be done with Playerlistener, as follows:
public void Playerupdate (Player p, String event, Object obj) {
Switch (p.getstate ()) {
Case player.started:
initialized = true;
Break
}
}
You also need to call the Graphics.setclip (0,0,0,0) method after the drawing is complete.
public void Paint (Graphics g) {
if (camera!=null) {
if (camera.isinitialized () &&!update) {
Menu.draw (g);
G.setclip (0, 0, 0, 0);
}else if (update) {
Update = FALSE;
}
}
}
Run the results as shown above. This feature is more useful, when you read the SE developer community today, you can look at the original
http://developer.sonyericsson.com/site/global/techsupport/
tipstrickscode/java/p_video_overlay_draw_canvas.jsp
Uploadfiles/2007-1/18575526.zip this is code.