public interface EmbeddedMediaPlayer extends MediaPlayer
Note that to get mouse and keyboard events delivered via listeners on some platforms (i.e. Windows)
you will likely need to invoke setEnableMouseInputHandling(boolean)
strong
setEnableKeyInputHandling(boolean)
.
Modifier and Type | Method and Description |
---|---|
void |
attachVideoSurface()
Ensure that the video surface has been associated with the native media player.
|
void |
enableOverlay(boolean enable)
Enable/disable the overlay component if there is one.
|
Window |
getOverlay()
Get the overlay component.
|
BufferedImage |
getVideoSurfaceContents()
Get the contents of the video surface component.
|
boolean |
isFullScreen()
Check whether the full-screen mode is currently active or not.
|
boolean |
overlayEnabled()
Check whether or not there is an overlay component currently enabled.
|
void |
setEnableKeyInputHandling(boolean enable)
Set whether or not to enable native media player keyboard input handling.
|
void |
setEnableMouseInputHandling(boolean enable)
Set whether or not to enable native media player mouse input handling.
|
void |
setFullScreen(boolean fullScreen)
Set full-screen mode.
|
void |
setFullScreenStrategy(FullScreenStrategy fullScreenStrategy)
Set a full-screen strategy implementation.
|
void |
setOverlay(Window overlay)
Set a new overlay component.
|
void |
setVideoSurface(CanvasVideoSurface videoSurface)
Set the component used to render video.
|
void |
toggleFullScreen()
Toggle whether the video display is in full-screen or not.
|
addMediaOptions, addMediaPlayerEventListener, canPause, cycleSpu, enableEvents, enableLogo, enableMarquee, getAllChapterDescriptions, getAspectRatio, getAudioChannel, getAudioDelay, getAudioDescriptions, getAudioOutputDevice, getAudioOutputDevices, getAudioTrack, getAudioTrackCount, getBrightness, getChapter, getChapterCount, getChapterDescriptions, getChapterDescriptions, getCodecDescription, getContrast, getCropGeometry, getEqualizer, getFps, getGamma, getHue, getLength, getMediaDetails, getMediaMeta, getMediaMeta, getMediaPlayerState, getMediaState, getMediaStatistics, getMediaStatistics, getPosition, getRate, getRepeat, getSaturation, getScale, getSnapshot, getSnapshot, getSpu, getSpuCount, getSpuDelay, getSpuDescriptions, getSubItemMediaMeta, getSubItemTrackInfo, getTeletextPage, getTime, getTitle, getTitleCount, getTitleDescriptions, getTrackInfo, getTrackInfo, getVideoDescriptions, getVideoDimension, getVideoOutputs, getVideoTrack, getVideoTrackCount, getVolume, isAdjustVideo, isMediaParsed, isMute, isPlayable, isPlaying, isSeekable, mediaPlayerInstance, menuActivate, menuDown, menuLeft, menuRight, menuUp, mrl, mrl, mute, mute, nextChapter, nextFrame, parseMedia, pause, play, playMedia, playNextSubItem, playSubItem, prepareMedia, previousChapter, programScrambled, release, removeMediaPlayerEventListener, requestParseMedia, requestParseMediaWithOptions, saveSnapshot, saveSnapshot, saveSnapshot, saveSnapshot, setAdjustVideo, setAspectRatio, setAudioChannel, setAudioDelay, setAudioOutput, setAudioOutputDevice, setAudioTrack, setBrightness, setChapter, setContrast, setCropGeometry, setDeinterlace, setEqualizer, setGamma, setHue, setLogoFile, setLogoImage, setLogoLocation, setLogoOpacity, setLogoOpacity, setLogoPosition, setMarqueeColour, setMarqueeColour, setMarqueeLocation, setMarqueeOpacity, setMarqueeOpacity, setMarqueePosition, setMarqueeSize, setMarqueeText, setMarqueeTimeout, setPause, setPlaySubItems, setPosition, setRate, setRepeat, setSaturation, setScale, setSnapshotDirectory, setSpu, setSpuDelay, setStandardMediaOptions, setSubTitleFile, setSubTitleFile, setTeletextPage, setTime, setTitle, setVideoTitleDisplay, setVideoTrack, setVolume, skip, skipPosition, start, startMedia, stop, subItemCount, subItemIndex, subItems, subItemsMedia, subItemsMediaList, toggleTeletext, userData, userData
void setVideoSurface(CanvasVideoSurface videoSurface)
Setting the video surface on the native component is actually deferred so the component used as the video surface need not be visible and fully realised before calling this method.
The video surface will not be associated with the native media player until the media is played.
It is possible to change the video surface after it has been set, but the change will not take effect until the media is played.
videoSurface
- component to render video tovoid attachVideoSurface()
Ordinarily when setting the video surface the actual association of the video surface with the native media player is deferred until the first time media is played.
This deferring behaviour is usually a good thing because when setting a video surface component on the native media player the video surface component must be a displayable component and this is often not the case during the construction and initialisation of the application.
Most applications will not need to call this method.
However, in special circumstances such as associating an embedded media player with a media list player, media is played through the media list rather than the media player itself so the deferred association of the video surface would never happen.
Calling this method ensures that the video surface is properly associated with the native media player and consequently the video surface component must be visible when this method is called.
void setFullScreenStrategy(FullScreenStrategy fullScreenStrategy)
The preferred way to set a full-screen strategy is via a constructor argument, nevertheless there are scenarios where it is more convenient to set the full-screen strategy after creation of the media player (depends how the application UI is created).
Applications should not change the full-screen strategy implementation after initialisation of the media player. Doing so makes no practical sense and the resultant behaviour is undefined.
fullScreenStrategy
- full-screen strategyvoid toggleFullScreen()
Setting the display into or out of full-screen mode is delegate to the
FullScreenStrategy
that was used when the media player was created.
void setFullScreen(boolean fullScreen)
Setting the display into or out of full-screen mode is delegate to the
FullScreenStrategy
that was used when the media player was created.
fullScreen
- true for full-screen, otherwise falseboolean isFullScreen()
Testing whether or not the display is in full-screen mode is delegate to the
FullScreenStrategy
that was used when the media player was created.
BufferedImage getVideoSurfaceContents()
The implementation is expected to use the AWT Robot class to capture the contents of the video surface component (there is no other way).
The size of the returned image will match the current size of the video surface.
Since this implementation will use the AWT Robot class to make a screen capture, care must be taken when invoking this method to ensure that nothing else is overlaying the video surface!
Window getOverlay()
null
void setOverlay(Window overlay)
The existing overlay if there is one will be disabled.
The new overlay will not automatically be enabled.
The overlay should be a sub-class of Window
or JWindow
. If your
overlay contains dynamically updated content such as a timer or animated graphics, then you
should use JWindow
so that your updates will be double-buffered and there will
be no tearing or flickering when you paint the overlay. If you do this, you must take care to
erase the overlay background before you paint it.
overlay
- overlay component, may be null
void enableOverlay(boolean enable)
enable
- whether to enable the overlay or disable itboolean overlayEnabled()
void setEnableMouseInputHandling(boolean enable)
It may be necessary on some platforms to invoke this method with a false
parameter
value for Java mouse and keyboard listeners to work.
Note that clicking the video surface on certain platforms is not guaranteed to capture mouse events - it may be necessary to respond to a mouse pressed event on the video surface and explicitly request the input focus to the video surface.
enable
- true
to enable, false
to disablevoid setEnableKeyInputHandling(boolean enable)
It may be necessary on some platforms to invoke this method with a false
parameter
value for Java mouse and keyboard listeners to work.
enable
- true
to enable, false
to disableCopyright © 2009–2015 Caprica Software Limited. All rights reserved.