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.


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 createVideoPeer(java.io.InputStream stream, java.lang.String mimeType)
          Create a video component
static VideoComponent createVideoPeer(java.lang.String url)
          Create a video component
abstract  int getMediaDuration()
          Returns the duration in milliseconds
abstract  int getMediaTimeMS()
          Return the duration of the media in milliseconds
 int getMediaTimeSeconds()
          Return the duration of the media
 boolean hasNativeFullscreenPlayer()
          Some platforms might allow invoking the native video player for this file type
abstract  boolean isFullScreen()
          Indicates the fullscreen mode
abstract  boolean isPlaying()
          Indicates if the media is currently in the playing state
 void playInNativePlayer()
          This method will only work if hasNativeFullscreenPlayer returns true
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 setMediaTimeMS(int now)
          "Jump" to a point in time within the media in milliseconds
 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()
          Stop 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, dragEnter, dragExit, draggingOver, dragInitiated, drawDraggedImage, drop, getAbsoluteX, getAbsoluteY, getBaseline, getBaselineResizeBehavior, getBorder, getBottomGap, getBounds, getClientProperty, getComponentForm, getDirtyRegion, getDisabledStyle, getDragImage, getGridPosX, getGridPosY, getHeight, getLabelForComponent, getName, getNextFocusDown, getNextFocusLeft, getNextFocusRight, getNextFocusUp, getParent, getPreferredH, getPreferredSize, getPreferredW, getPressedStyle, getPropertyNames, getPropertyTypes, getPropertyValue, getScrollAnimationSpeed, getScrollDimension, getScrollOpacity, getScrollOpacityChangeSpeed, getScrollX, getScrollY, getSelectCommandText, getSelectedRect, getSelectedStyle, getSideGap, getStyle, getTensileLength, getUIID, getUnselectedStyle, getWidth, getVisibleBounds, getX, getY, growShrink, hasFocus, initCustomStyle, installDefaultPainter, isAlwaysTensile, isDragActivated, isDragAndDropOperation, isDraggable, isDropTarget, isEnabled, isFlatten, isFocusable, isGrabsPointerEvents, isHideInPortrait, 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, setAlwaysTensile, setCellRenderer, setDirtyRegion, setDisabledStyle, setDraggable, setDropTarget, setEnabled, setFlatten, setFocus, setFocusable, setGrabsPointerEvents, setHandlesInput, setHeight, setHideInPortrait, setInitialized, setIsScrollVisible, setLabelForComponent, setName, setNextFocusDown, setNextFocusLeft, setNextFocusRight, setNextFocusUp, setPreferredH, setPreferredSize, setPreferredW, setPressedStyle, setPropertyValue, setRTL, setScrollAnimationSpeed, setScrollOpacityChangeSpeed, setScrollSize, setScrollVisible, setScrollX, setScrollY, setSelectCommandText, setSelectedStyle, setShouldCalcPreferredSize, setSize, setSmoothScrolling, setSnapToGrid, setTactileTouch, setTensileDragEnabled, setTensileLength, setUIID, setUnselectedStyle, setWidth, setVisible, setX, setY, styleChanged, toString
 
Methods inherited from class java.lang.Object
equals, 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

createVideoPeer

public static VideoComponent createVideoPeer(java.lang.String url)
                                      throws java.io.IOException
Create a video component

Parameters:
url - the platform specific location for the sound
Returns:
a VideoComponent that can be used to control the playback of the video
Throws:
java.io.IOException - if the allocation fails

createVideoPeer

public static VideoComponent createVideoPeer(java.io.InputStream stream,
                                             java.lang.String mimeType)
                                      throws java.io.IOException
Create a video component

Parameters:
stream - the stream containing the media data
mimeType - the type of the data in the stream
Returns:
a VideoComponent that can be used to control the playback of the video
Throws:
java.io.IOException - if the allocation fails

start

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


stop

public abstract void stop()
Stop 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 int getMediaTimeSeconds()
Return the duration of the media

Returns:
the duration of the media

setMediaTimeSeconds

public 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 seconds

getMediaTimeMS

public abstract int getMediaTimeMS()
Return the duration of the media in milliseconds

Returns:
the duration of the media

setMediaTimeMS

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

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

getMediaDuration

public abstract int getMediaDuration()
Returns the duration in milliseconds

Returns:
the media duration

isPlaying

public abstract boolean isPlaying()
Indicates if the media is currently in the playing state

Returns:
true if the media is playing

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

hasNativeFullscreenPlayer

public boolean hasNativeFullscreenPlayer()
Some platforms might allow invoking the native video player for this file type

Returns:
true if the native player can be used for this file

playInNativePlayer

public void playInNativePlayer()
This method will only work if hasNativeFullscreenPlayer returns true