example.mmademo
Class VideoCanvas

java.lang.Object
  extended by javax.microedition.lcdui.Displayable
      extended by javax.microedition.lcdui.Canvas
          extended by example.mmademo.VideoCanvas
All Implemented Interfaces:
java.lang.Runnable, javax.microedition.lcdui.CommandListener, javax.microedition.media.PlayerListener

public class VideoCanvas
extends javax.microedition.lcdui.Canvas
implements java.lang.Runnable, javax.microedition.lcdui.CommandListener, javax.microedition.media.PlayerListener

Play/Capture Video in a Canvas


Nested Class Summary
(package private)  class VideoCanvas.SnapshotThread
           
 
Field Summary
 
Fields inherited from class javax.microedition.lcdui.Canvas
DOWN, FIRE, GAME_A, GAME_B, GAME_C, GAME_D, KEY_NUM0, KEY_NUM1, KEY_NUM2, KEY_NUM3, KEY_NUM4, KEY_NUM5, KEY_NUM6, KEY_NUM7, KEY_NUM8, KEY_NUM9, KEY_POUND, KEY_STAR, LEFT, RIGHT, UP
 
Fields inherited from interface javax.microedition.media.PlayerListener
BUFFERING_STARTED, BUFFERING_STOPPED, CLOSED, DEVICE_AVAILABLE, DEVICE_UNAVAILABLE, DURATION_UPDATED, END_OF_MEDIA, ERROR, RECORD_ERROR, RECORD_STARTED, RECORD_STOPPED, SIZE_CHANGED, STARTED, STOPPED, STOPPED_AT_TIME, VOLUME_CHANGED
 
Constructor Summary
VideoCanvas(javax.microedition.lcdui.Display parentDisplay)
           
 
Method Summary
 void close()
           
 void commandAction(javax.microedition.lcdui.Command c, javax.microedition.lcdui.Displayable s)
           
 void keyPressed(int keyCode)
           
 void open(java.lang.String url)
           
 void paint(javax.microedition.lcdui.Graphics g)
           
 void pause()
           
 void pauseApp()
          Deallocate the player and the display thread.
 void playerUpdate(javax.microedition.media.Player plyr, java.lang.String evt, java.lang.Object evtData)
           
protected  void pointerDragged(int x, int y)
           
protected  void pointerPressed(int x, int y)
           
 void run()
           
 void start()
           
 void startApp()
          If the player was playing when the MIDlet was paused, then the player will be restarted here.
 void stopVideoCanvas()
           
 
Methods inherited from class javax.microedition.lcdui.Canvas
getGameAction, getKeyCode, getKeyName, hasPointerEvents, hasPointerMotionEvents, hasRepeatEvents, hideNotify, isDoubleBuffered, keyReleased, keyRepeated, pointerReleased, repaint, repaint, serviceRepaints, setFullScreenMode, showNotify, sizeChanged
 
Methods inherited from class javax.microedition.lcdui.Displayable
addCommand, getHeight, getTicker, getTitle, getWidth, isShown, removeCommand, setCommandListener, setTicker, setTitle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VideoCanvas

public VideoCanvas(javax.microedition.lcdui.Display parentDisplay)
Method Detail

paint

public void paint(javax.microedition.lcdui.Graphics g)
Specified by:
paint in class javax.microedition.lcdui.Canvas

run

public void run()
Specified by:
run in interface java.lang.Runnable

commandAction

public void commandAction(javax.microedition.lcdui.Command c,
                          javax.microedition.lcdui.Displayable s)
Specified by:
commandAction in interface javax.microedition.lcdui.CommandListener

pointerPressed

protected void pointerPressed(int x,
                              int y)
Overrides:
pointerPressed in class javax.microedition.lcdui.Canvas

pointerDragged

protected void pointerDragged(int x,
                              int y)
Overrides:
pointerDragged in class javax.microedition.lcdui.Canvas

open

public void open(java.lang.String url)

start

public void start()

close

public void close()

pause

public void pause()

playerUpdate

public void playerUpdate(javax.microedition.media.Player plyr,
                         java.lang.String evt,
                         java.lang.Object evtData)
Specified by:
playerUpdate in interface javax.microedition.media.PlayerListener

stopVideoCanvas

public void stopVideoCanvas()

keyPressed

public void keyPressed(int keyCode)
Overrides:
keyPressed in class javax.microedition.lcdui.Canvas

pauseApp

public void pauseApp()
Deallocate the player and the display thread. Some VM's may stop players and threads on their own, but for consistent user experience, it's a good idea to explicitely stop and start resources such as player and threads.


startApp

public void startApp()
If the player was playing when the MIDlet was paused, then the player will be restarted here.