com.sun.lwuit
Class VideoComponent

java.lang.Object
  extended by com.sun.lwuit.Component
      extended by com.sun.lwuit.PeerComponent
          extended by com.sun.lwuit.VideoComponent
All Implemented Interfaces:
Animation, StyleListener

public abstract class VideoComponent
extends PeerComponent

Allows embedding a video into a LWUIT component, video creation/management is very platform specific and this component tries to abstract that logic as much as possible while maintaining portability.

Notice that unlike the previous implementation these implementations completely hide the underlying MMAPI (or other) interface. To access it directly you can extract the Player/VideoControl instance (if applicable in this implementation) by invoking getClientProperty("Player")/getClientProperty("VideoController"). This behavior is implementation specific and we encorage implementations to expose such features via the client property facility.

Author:
Shai Almog

Field Summary
 
Fields inherited from class com.sun.lwuit.Component
BOTTOM, BRB_CENTER_OFFSET, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_OTHER, CENTER, LEFT, RIGHT, TOP
 
Constructor Summary
protected VideoComponent(java.lang.Object nativePeer)
          This constructor is used internally by the LWUIT implementation class
 
Method Summary
static VideoComponent create(java.lang.Object videoInfo, java.lang.String type)
          Creates a new instance of the video component
abstract  int getMediaTimeSeconds()
          Return the duration of the media
abstract  boolean isFullScreen()
          Indicates the fullscreen mode
abstract  void setFullScreen(boolean fullscreen)
          Toggles the fullscreen mode
abstract  void setLoopCount(int count)
          Set the number of times the media should loop
abstract  int setMediaTimeSeconds(int now)
          "Jump" to a point in time within the media
protected  void setNativePeer(java.lang.Object nativePeer)
          Some devices might not allow extracting the native peer before the first initialization
abstract  void start()
          Start media playback implicitly setting the component to visible
abstract  void stop()
          Stope media playback
 
Methods inherited from class com.sun.lwuit.PeerComponent
animate, calcPreferredSize, calcScrollSize, create, deinitialize, fireClicked, focusGained, focusLost, getNativePeer, handlesInput, initComponent, invalidate, isBorderPainted, keyPressed, keyReleased, keyRepeated, onPositionSizeChange, paint, paintBackground, paintBackgrounds, paintBorder, paintScrollbars, paintScrollbarX, paintScrollbarY, pointerDragged, pointerDragged, pointerHover, pointerHoverReleased, pointerPressed, pointerPressed, pointerReleased, pointerReleased
 
Methods inherited from class com.sun.lwuit.Component
addFocusListener, contains, deinitializeCustomStyle, dragInitiated, getAbsoluteX, getAbsoluteY, getBaseline, getBaselineResizeBehavior, getBorder, getBottomGap, getBounds, getClientProperty, getComponentForm, getDirtyRegion, getDisabledStyle, getGridPosX, getGridPosY, getHeight, getLabelForComponent, getName, getNextFocusDown, getNextFocusLeft, getNextFocusRight, getNextFocusUp, getParent, getPreferredH, getPreferredSize, getPreferredW, getPressedStyle, getPropertyNames, getPropertyTypes, getPropertyValue, getScrollAnimationSpeed, getScrollDimension, getScrollOpacity, getScrollX, getScrollY, getSelectCommandText, getSelectedStyle, getSideGap, getStyle, getUIID, getUnselectedStyle, getVisibleBounds, getWidth, getX, getY, hasFocus, initCustomStyle, isDragActivated, isEnabled, isFocusable, isFocusPainted, isInitialized, isRTL, isScrollable, isScrollableX, isScrollableY, isScrollVisible, isSelectableInteraction, isSmoothScrolling, isSnapToGrid, isTactileTouch, isTactileTouch, isTensileDragEnabled, isVisible, laidOut, longKeyPress, longPointerPress, paintComponent, paintComponent, paintLock, paintLockRelease, paramString, pointerHoverPressed, putClientProperty, refreshTheme, refreshTheme, removeFocusListener, repaint, repaint, requestFocus, scrollRectToVisible, scrollRectToVisible, setCellRenderer, setDirtyRegion, setDisabledStyle, setEnabled, setFocus, setFocusable, setFocusPainted, setHandlesInput, setHeight, setInitialized, setIsScrollVisible, setLabelForComponent, setName, setNextFocusDown, setNextFocusLeft, setNextFocusRight, setNextFocusUp, setPreferredH, setPreferredSize, setPreferredW, setPressedStyle, setPropertyValue, setRTL, setScrollAnimationSpeed, setScrollSize, setScrollVisible, setScrollX, setScrollY, setSelectCommandText, setSelectedStyle, setShouldCalcPreferredSize, setSize, setSmoothScrolling, setSnapToGrid, setStyle, setTactileTouch, setTensileDragEnabled, setUIID, setUnselectedStyle, setUnSelectedStyle, setVisible, setWidth, setX, setY, styleChanged, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

VideoComponent

protected VideoComponent(java.lang.Object nativePeer)
This constructor is used internally by the LWUIT implementation class

Parameters:
nativePeer - the native peer
Method Detail

setNativePeer

protected void setNativePeer(java.lang.Object nativePeer)
Some devices might not allow extracting the native peer before the first initialization

Parameters:
nativePeer - the native peer

create

public static VideoComponent create(java.lang.Object videoInfo,
                                    java.lang.String type)
                             throws java.io.IOException
Creates a new instance of the video component

Parameters:
videoInfo - a platform specific video source identifier, a string with a video URL is most common although some platforms might support an input stream or some other information
type - the video type if required by the native platform
Returns:
a LWUIT Video component that can be manipulated just like any other LWUIT component but would internally encapsulate the given video
Throws:
java.io.IOException

start

public abstract void start()
Start media playback implicitly setting the component to visible


stop

public abstract void stop()
Stope media playback


setLoopCount

public abstract void setLoopCount(int count)
Set the number of times the media should loop

Parameters:
count - the number of times the media should loop

getMediaTimeSeconds

public abstract int getMediaTimeSeconds()
Return the duration of the media

Returns:
the duration of the media

setMediaTimeSeconds

public abstract int setMediaTimeSeconds(int now)
"Jump" to a point in time within the media

Parameters:
now - the point in time to "Jump" to
Returns:
the media time in microseconds

setFullScreen

public abstract void setFullScreen(boolean fullscreen)
Toggles the fullscreen mode

Parameters:
fullscreen - true for fullscreen mode

isFullScreen

public abstract boolean isFullScreen()
Indicates the fullscreen mode

Returns:
true for fullscreen mode