|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.enough.polish.ui.Item
de.enough.polish.ui.Container
de.enough.polish.video.VideoContainer
public class VideoContainer
A Container to play a video in its content area. Usually a VideoContainer is filled with items and appended to a Screen or Container and a controlling instance is set as the callback for the VideoContainer. The VideoSource is set via setSource(). setRatio(), setRepeat() etc. are optional. To initialize the player, the dimensions etc. for the video, prepare() is called. When the Container is fully initialized (displayed on the screen) and the player and dimensions are set, the listener is notified via onVideoReady() and the video can be played.
| Nested Class Summary | |
|---|---|
static class |
VideoContainer.Ratio
The ratio to use (i.e. |
class |
VideoContainer.Seek
|
static class |
VideoContainer.Test
Static methods to test videoplayback |
| Field Summary | |
|---|---|
static int |
STATE_CLOSED
The video is stopped |
static int |
STATE_NOT_PREPARED
The video is not yet prepared |
static int |
STATE_PAUSED
The video is paused |
static int |
STATE_PLAYING
The video is playing |
static int |
STATE_READY
The video is fully prepared |
static int |
STATE_STOPPED
The video is stopped |
| Fields inherited from class de.enough.polish.ui.Container |
|---|
allowCycling, autoFocusEnabled, autoFocusIndex, containerView, enableScrolling, focusAllStyle, focusedIndex, focusedItem, focusedStyleFirst, focusedStyleLast, isExpandItems, itemsList, itemStyle, lastPointerPressTime, lastPointerPressY, lastPointerPressYOffset, plainStyle, SCROLL_DEFAULT, SCROLL_SMOOTH, scrollHeight, scrollSmooth, targetYOffset, yOffset |
| Fields inherited from interface javax.microedition.media.PlayerListener |
|---|
CLOSED, DEVICE_AVAILABLE, DEVICE_UNAVAILABLE, DURATION_UPDATED, END_OF_MEDIA, ERROR, STARTED, STOPPED, VOLUME_CHANGED |
| Constructor Summary | |
|---|---|
VideoContainer()
Constructs a new VideoContainer instance |
|
VideoContainer(boolean adjustSizeAutomatically)
Constructs a new VideoContainer instance |
|
VideoContainer(boolean adjustSizeAutomatically,
Style style)
Constructs a new VideoContainer |
|
VideoContainer(Style style)
Constructs a new VideoContainer instance with the given screen as parent |
|
| Method Summary | |
|---|---|
void |
addCallback(VideoCallback callback)
Adds a callback |
boolean |
animate()
Animates this item. |
void |
animate(long currentTime,
ClippingRegion repaintRegion)
Animates this item. |
byte[] |
capture(String encoding)
Captures a snapshot when a CaptureSource is used. |
void |
close()
Closes this VideoContainer. |
Exception |
getLastException()
Retrieves the last exception that occurred, if any |
long |
getLength()
Returns the total length of the video |
VideoSource |
getSource()
Returns the current VideoSource |
int |
getState()
Returns the current state of the VideoContainer |
long |
getTime()
Returns the current time of the playback |
int |
getVolume()
Returns the volume |
protected void |
hideNotify()
Called by the system to notify the item that it is now completely invisible, when it previously had been at least partially visible. |
protected void |
initContent(int firstLineWidth,
int availWidth,
int availHeight)
Initialises this item. |
protected void |
initDisplay(VideoSource src)
Initializes the display by using the content area of the Container. |
protected void |
initSource(VideoSource src)
Initializes the source by calling open() on it |
protected void |
initVolume(VideoSource source)
Initializes the volume |
boolean |
isFullscreen()
Returns true if the video is played in fullscreen mode |
boolean |
isLandscape()
Returns true if the video should be played in landscape mode |
boolean |
isMute()
|
boolean |
isRepeat()
Returns true if the video should be repeated |
void |
mute(boolean mute)
|
void |
next()
|
void |
onSnapshot(byte[] data,
String encoding)
Called when a capture is done |
void |
onVideoClose()
Called when a video is destroyed |
void |
onVideoError(Exception e)
Called when an error occures |
void |
onVideoPause()
Called when the video is paused |
void |
onVideoPlay()
Called when the video is played |
void |
onVideoReady()
Called when a video is fully prepared |
void |
onVideoStop()
Called when the video is stopped |
void |
paint(int x,
int y,
int leftBorder,
int rightBorder,
Graphics g)
Paints this item on the screen. |
void |
pause()
Pauses the video |
void |
play()
Plays the video or shows the snapshot preview window. |
void |
playerUpdate(Player player,
String event,
Object data)
|
void |
prepare()
Starts the thread to prepare the video if the state is zero |
void |
removeCallback(VideoCallback callback)
Removes a callback |
void |
run()
Prepares the video by creating the player, initializing the display and controls and notifying the listeners when its done. |
void |
seek(long position)
Set the player to the given position. |
protected void |
setDisplay(VideoControl control,
int x,
int y,
int width,
int height,
VideoContainer.Ratio ratio)
Set the display by using the given VideoControl instance and the dimensions given |
void |
setEnterFullscreenGameAction(int gameAction)
Sets a shortcut |
void |
setFullscreen(boolean fullscreen)
Enters or leaves the fullscreen mode. |
void |
setFullscreen(VideoSource src,
boolean fullscreen)
Enters or leaves the fullscreen mode. |
void |
setLandscape(boolean landscape)
Sets the landscape mode |
void |
setMultipart(VideoMultipart multipart)
] Sets a VideoMultipart as the source. |
void |
setPseudoFullscreen(boolean fullscreen)
Enters or leaves the fullscreen mode by using another styleable form |
void |
setPseudoFullscreen(VideoSource src,
boolean fullscreen)
Enters or leaves the fullscreen mode by using another styleable form |
void |
setRatio(VideoContainer.Ratio ratio)
Sets the ratio to playback the video |
void |
setRepeat(boolean repeat)
Sets the repeat mode |
void |
setScreen(Screen screen)
Convenience method to set the screen if the VideoContainer is not added to a Screen or a Container. |
void |
setSource(VideoSource source)
Sets the VideoSource of this VideoContainer. |
void |
setVolume(int volume)
Sets the volume |
protected void |
showNotify()
Called by the system to notify the item that it is now at least partially visible, when it previously had been completely invisible. |
void |
stop()
Stops the video |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int STATE_CLOSED
public static final int STATE_NOT_PREPARED
public static final int STATE_READY
public static final int STATE_PLAYING
public static final int STATE_PAUSED
public static final int STATE_STOPPED
| Constructor Detail |
|---|
public VideoContainer()
public VideoContainer(Style style)
public VideoContainer(boolean adjustSizeAutomatically)
adjustSizeAutomatically - true when the size of this container should be adjusted according to the video source
public VideoContainer(boolean adjustSizeAutomatically,
Style style)
adjustSizeAutomatically - true when the size of this container should be adjusted according to the video sourcestyle - the style| Method Detail |
|---|
public void animate(long currentTime,
ClippingRegion repaintRegion)
Item
animate in interface Animatableanimate in class ContainercurrentTime - the current time in millisecondsrepaintRegion - the repaint area that needs to be updated when this item is animatedItem.addRelativeToContentRegion(ClippingRegion, int, int, int, int)public void setScreen(Screen screen)
screen - the screenpublic void setSource(VideoSource source)
source - the VideoSource to usepublic VideoSource getSource()
public void setMultipart(VideoMultipart multipart)
multipart - the VideoMultipart instancepublic void close()
public void addCallback(VideoCallback callback)
callback - the callbackpublic void removeCallback(VideoCallback callback)
callback - the callbackpublic void setEnterFullscreenGameAction(int gameAction)
gameAction -
protected void initSource(VideoSource src)
throws Exception
src - the VideoSource to use
Exception - if an error occurs
protected void initDisplay(VideoSource src)
throws Exception
src - the VideoSource to use
Exception - if an error occurs
protected void setDisplay(VideoControl control,
int x,
int y,
int width,
int height,
VideoContainer.Ratio ratio)
throws Exception
control - the VideoControl instancex - the x positiony - the y positionwidth - the widthheight - the heightratio - the ratio to use
Exception - if an error occurs
protected void initVolume(VideoSource source)
throws Exception
source - the VideoSource to use
Exception - if an error occurspublic void prepare()
public void play()
public void pause()
public void stop()
public void seek(long position)
position - the position in microsecondspublic long getTime()
public long getLength()
public void setVolume(int volume)
volume - the volume to setpublic int getVolume()
public boolean animate()
Item
animate in class ItemItem.animate(long, ClippingRegion)
public void paint(int x,
int y,
int leftBorder,
int rightBorder,
Graphics g)
Item
paint in class Itemx - the left start position of this item.y - the top start position of this item.leftBorder - the left border, nothing must be painted left of this positionrightBorder - the right border, nothing must be painted right of this position,
rightBorder > x >= leftBorderg - the Graphics on which this item should be painted.public void setFullscreen(boolean fullscreen)
fullscreen - true if fullscreen mode should be entered, otherwise false
IllegalStateException - when no video source has been set
public void setFullscreen(VideoSource src,
boolean fullscreen)
src - the video sourcefullscreen - true if fullscreen mode should be entered, otherwise false
IllegalArgumentException - when src is null
IllegalStateException - when the source cannot retrieve a VideoControlpublic void setPseudoFullscreen(boolean fullscreen)
fullscreen - true if fullscreen mode should be entered, otherwise false
IllegalArgumentException - when no video source has been set
public void setPseudoFullscreen(VideoSource src,
boolean fullscreen)
src - the video sourcefullscreen - true if fullscreen mode should be entered, otherwise false
IllegalArgumentException - when src is nullpublic void run()
run in interface Runnablepublic void next()
protected void initContent(int firstLineWidth,
int availWidth,
int availHeight)
Item
initContent in class ContainerfirstLineWidth - the maximum width of the first lineavailWidth - the available maximum width of this item in pixelsavailHeight - the available maximum height of this item in pixelsItem.contentWidth,
Item.contentHeight,
Item.preferredWidth,
Item.preferredHeight
public void playerUpdate(Player player,
String event,
Object data)
playerUpdate in interface PlayerListenerpublic boolean isLandscape()
public void setLandscape(boolean landscape)
landscape - true if the video should be played in landscape mode, otherwise falsepublic boolean isRepeat()
public void setRepeat(boolean repeat)
repeat - true if the video should be repeated, otherwise falsepublic void setRatio(VideoContainer.Ratio ratio)
ratio - the ratiopublic int getState()
public boolean isFullscreen()
public void mute(boolean mute)
public boolean isMute()
protected void showNotify()
Containerpaint() calls after
showNotify() has been called.
The container implementation calls showNotify() on the embedded items.
showNotify in class Containerpublic byte[] capture(String encoding)
encoding - the encoding of the image
protected void hideNotify()
Containerpaint() calls will be made on this item
until after a showNotify() has been called again.
The container implementation calls hideNotify() on the embedded items.
hideNotify in class Container
public void onSnapshot(byte[] data,
String encoding)
VideoCallback
onSnapshot in interface VideoCallbackdata - the resulting data of the capturepublic void onVideoClose()
VideoCallback
onVideoClose in interface VideoCallbackpublic void onVideoError(Exception e)
VideoCallback
onVideoError in interface VideoCallbackpublic Exception getLastException()
public void onVideoPause()
VideoCallback
onVideoPause in interface VideoCallbackpublic void onVideoPlay()
VideoCallback
onVideoPlay in interface VideoCallbackpublic void onVideoReady()
VideoCallback
onVideoReady in interface VideoCallbackpublic void onVideoStop()
VideoCallback
onVideoStop in interface VideoCallback
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||