Class CallbackMediaPlayerComponent
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- uk.co.caprica.vlcj.player.component.CallbackMediaPlayerComponent
-
- All Implemented Interfaces:
KeyListener
,MouseListener
,MouseMotionListener
,MouseWheelListener
,ImageObserver
,MenuContainer
,Serializable
,EventListener
,Accessible
,MediaEventListener
,MediaPlayerEventListener
,MediaPlayerComponent
- Direct Known Subclasses:
CallbackMediaListPlayerComponentBase
public class CallbackMediaPlayerComponent extends JPanel implements MediaPlayerComponent
Implementation of a callback "direct-rendering" media player.This component renders video frames received via native callbacks.
The component may be added directly to a user interface layout - this is optional, you can use this component without adding it directly to a user interface, in which case you would simply render the video however you like.
When the component is no longer needed, it should be released by invoking the
release()
method.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
-
Nested classes/interfaces inherited from class java.awt.Component
Component.BaselineResizeBehavior
-
-
Field Summary
-
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
-
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
-
Constructor Summary
Constructors Constructor Description CallbackMediaPlayerComponent()
Create a callback media player component with reasonable defaults.CallbackMediaPlayerComponent(MediaPlayerFactory mediaPlayerFactory, FullScreenStrategy fullScreenStrategy, InputEvents inputEvents, boolean lockBuffers, CallbackImagePainter imagePainter)
Construct a callback media list player component for intrinsic rendering (by this component).CallbackMediaPlayerComponent(MediaPlayerFactory mediaPlayerFactory, FullScreenStrategy fullScreenStrategy, InputEvents inputEvents, boolean lockBuffers, CallbackImagePainter imagePainter, RenderCallback renderCallback, BufferFormatCallback bufferFormatCallback, JComponent videoSurfaceComponent)
Construct a callback media player component.CallbackMediaPlayerComponent(MediaPlayerFactory mediaPlayerFactory, FullScreenStrategy fullScreenStrategy, InputEvents inputEvents, boolean lockBuffers, RenderCallback renderCallback, BufferFormatCallback bufferFormatCallback, JComponent videoSurfaceComponent)
Construct a callback media list player component for external rendering (by the client application).CallbackMediaPlayerComponent(MediaPlayerSpecs.CallbackMediaPlayerSpec spec)
Create a callback media player component from a builder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
audioDeviceChanged(MediaPlayer mediaPlayer, String audioDevice)
The audio device changed.void
backward(MediaPlayer mediaPlayer)
Media skipped backward.void
buffering(MediaPlayer mediaPlayer, float newCache)
Buffering media.void
chapterChanged(MediaPlayer mediaPlayer, int newChapter)
The chapter changed.void
corked(MediaPlayer mediaPlayer, boolean corked)
The media player was corked/un-corked.void
elementaryStreamAdded(MediaPlayer mediaPlayer, TrackType type, int id)
An elementary stream was added.void
elementaryStreamDeleted(MediaPlayer mediaPlayer, TrackType type, int id)
An elementary stream was deleted.void
elementaryStreamSelected(MediaPlayer mediaPlayer, TrackType type, int id)
An elementary stream was selected.void
error(MediaPlayer mediaPlayer)
An error occurred.void
finished(MediaPlayer mediaPlayer)
Media finished playing (i.e.void
forward(MediaPlayer mediaPlayer)
Media skipped forward.void
keyPressed(KeyEvent e)
void
keyReleased(KeyEvent e)
void
keyTyped(KeyEvent e)
void
lengthChanged(MediaPlayer mediaPlayer, long newLength)
Media length changed.void
mediaChanged(MediaPlayer mediaPlayer, MediaRef media)
The media changed.void
mediaDurationChanged(Media media, long newDuration)
The current media duration changed.void
mediaFreed(Media media, MediaRef mediaFreed)
The current media was freed.void
mediaMetaChanged(Media media, Meta metaType)
Current media meta data changed.void
mediaParsedChanged(Media media, MediaParsedStatus newStatus)
The current media parsed status changed.EmbeddedMediaPlayer
mediaPlayer()
Get the embedded media player reference.MediaPlayerFactory
mediaPlayerFactory()
Get the media player factory that was used to create the media player component.void
mediaPlayerReady(MediaPlayer mediaPlayer)
Media player is ready (to enable features like logo and marquee) after the media has started playing.void
mediaStateChanged(Media media, State newState)
The current media state changed.void
mediaSubItemAdded(Media media, MediaRef newChild)
A new sub-item was added to the current media.void
mediaSubItemTreeAdded(Media media, MediaRef item)
A sub-item tree was added to the media.void
mediaThumbnailGenerated(Media media, Picture picture)
void
mouseClicked(MouseEvent e)
void
mouseDragged(MouseEvent e)
void
mouseEntered(MouseEvent e)
void
mouseExited(MouseEvent e)
void
mouseMoved(MouseEvent e)
void
mousePressed(MouseEvent e)
void
mouseReleased(MouseEvent e)
void
mouseWheelMoved(MouseWheelEvent e)
void
muted(MediaPlayer mediaPlayer, boolean muted)
The audio was muted/un-muted.void
opening(MediaPlayer mediaPlayer)
Opening the media.void
pausableChanged(MediaPlayer mediaPlayer, int newSeekable)
Media pausable status changed.void
paused(MediaPlayer mediaPlayer)
Media paused.void
playing(MediaPlayer mediaPlayer)
The media started playing.void
positionChanged(MediaPlayer mediaPlayer, float newPosition)
Media play-back position changed.void
release()
Release the media player component and the associated native media player resources.void
scrambledChanged(MediaPlayer mediaPlayer, int newScrambled)
Program scrambled changed.void
seekableChanged(MediaPlayer mediaPlayer, int newSeekable)
Media seekable status changed.void
setCursorEnabled(boolean enabled)
Enable or disable the mouse cursor when it is over the component.void
setImagePainter(CallbackImagePainter imagePainter)
Set a new image painter.void
snapshotTaken(MediaPlayer mediaPlayer, String filename)
A snapshot was taken.void
stopped(MediaPlayer mediaPlayer)
Media stopped.void
timeChanged(MediaPlayer mediaPlayer, long newTime)
Media play-back time changed.void
titleChanged(MediaPlayer mediaPlayer, int newTitle)
Media title changed.void
videoOutput(MediaPlayer mediaPlayer, int newCount)
The number of video outputs changed.JComponent
videoSurfaceComponent()
Get the video surfaceCanvas
component.void
volumeChanged(MediaPlayer mediaPlayer, float volume)
The volume changed.-
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, setUI, updateUI
-
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Constructor Detail
-
CallbackMediaPlayerComponent
public CallbackMediaPlayerComponent(MediaPlayerFactory mediaPlayerFactory, FullScreenStrategy fullScreenStrategy, InputEvents inputEvents, boolean lockBuffers, CallbackImagePainter imagePainter, RenderCallback renderCallback, BufferFormatCallback bufferFormatCallback, JComponent videoSurfaceComponent)
Construct a callback media player component.This component will provide a reasonable default implementation, but a client application is free to override these defaults with their own implementation.
To rely on the defaults and have this component render the video, do not supply a
renderCallback
.If a client application wishes to perform its own rendering, provide a
renderCallback
, aBufferFormatCallback
, and optionally (but likely) avideoSurfaceComponent
if the client application wants the video surface they are rendering in to be incorporated into this component's layout.- Parameters:
mediaPlayerFactory
- media player factoryfullScreenStrategy
- full screen strategyinputEvents
- keyboard/mouse input event configurationlockBuffers
-true
if the native video buffer should be locked;false
if notimagePainter
- image painter (video renderer)renderCallback
- render callbackbufferFormatCallback
- buffer format callbackvideoSurfaceComponent
- lightweight video surface component
-
CallbackMediaPlayerComponent
public CallbackMediaPlayerComponent(MediaPlayerFactory mediaPlayerFactory, FullScreenStrategy fullScreenStrategy, InputEvents inputEvents, boolean lockBuffers, CallbackImagePainter imagePainter)
Construct a callback media list player component for intrinsic rendering (by this component).- Parameters:
mediaPlayerFactory
- media player factoryfullScreenStrategy
- full screen strategyinputEvents
- keyboard/mouse input event configurationlockBuffers
-true
if the native video buffer should be locked;false
if notimagePainter
- image painter (video renderer)
-
CallbackMediaPlayerComponent
public CallbackMediaPlayerComponent(MediaPlayerFactory mediaPlayerFactory, FullScreenStrategy fullScreenStrategy, InputEvents inputEvents, boolean lockBuffers, RenderCallback renderCallback, BufferFormatCallback bufferFormatCallback, JComponent videoSurfaceComponent)
Construct a callback media list player component for external rendering (by the client application).- Parameters:
mediaPlayerFactory
- media player factoryfullScreenStrategy
- full screen strategyinputEvents
- keyboard/mouse input event configurationlockBuffers
-true
if the native video buffer should be locked;false
if notrenderCallback
- render callbackbufferFormatCallback
- buffer format callbackvideoSurfaceComponent
- lightweight video surface component
-
CallbackMediaPlayerComponent
public CallbackMediaPlayerComponent(MediaPlayerSpecs.CallbackMediaPlayerSpec spec)
Create a callback media player component from a builder.- Parameters:
spec
- builder
-
CallbackMediaPlayerComponent
public CallbackMediaPlayerComponent()
Create a callback media player component with reasonable defaults.
-
-
Method Detail
-
setImagePainter
public final void setImagePainter(CallbackImagePainter imagePainter)
Set a new image painter.The image painter should only be changed when the media is stopped, changing an image painter during playback has undefined behaviour.
This is not used if the application has supplied its own
RenderCallback
on instance creation.- Parameters:
imagePainter
- image painter
-
mediaPlayer
public final EmbeddedMediaPlayer mediaPlayer()
Get the embedded media player reference.An application uses this handle to control the media player, add listeners and so on.
- Returns:
- media player
-
videoSurfaceComponent
public final JComponent videoSurfaceComponent()
Get the video surfaceCanvas
component.An application may want to add key/mouse listeners to the video surface component.
- Returns:
- video surface component
-
release
public final void release()
Release the media player component and the associated native media player resources.
-
mediaPlayerFactory
public final MediaPlayerFactory mediaPlayerFactory()
Description copied from interface:MediaPlayerComponent
Get the media player factory that was used to create the media player component.If the client application did not suppl a media player factory when creating the component, then the component is the "owner" of the returned factory instance. A client application must not releasse the factory in this case.
If a client application did supply the factory, then the client application is wholly responsible for the correct life-cycle of that factory and should release it at the appropriate time.
- Specified by:
mediaPlayerFactory
in interfaceMediaPlayerComponent
- Returns:
- factory
-
setCursorEnabled
public final void setCursorEnabled(boolean enabled)
Enable or disable the mouse cursor when it is over the component.Note that you may see glitchy behaviour if you try and disable the cursor after you show the window/frame that contains your video surface.
If you want to disable the cursor for this component you should do so before you show the window.
- Parameters:
enabled
-true
to enable (show) the cursor;false
to disable (hide) it
-
mediaChanged
public void mediaChanged(MediaPlayer mediaPlayer, MediaRef media)
Description copied from interface:MediaPlayerEventListener
The media changed.- Specified by:
mediaChanged
in interfaceMediaPlayerEventListener
- Parameters:
mediaPlayer
- media player that raised the eventmedia
- new media instance
-
opening
public void opening(MediaPlayer mediaPlayer)
Description copied from interface:MediaPlayerEventListener
Opening the media.- Specified by:
opening
in interfaceMediaPlayerEventListener
- Parameters:
mediaPlayer
- media player that raised the event
-
buffering
public void buffering(MediaPlayer mediaPlayer, float newCache)
Description copied from interface:MediaPlayerEventListener
Buffering media.- Specified by:
buffering
in interfaceMediaPlayerEventListener
- Parameters:
mediaPlayer
- media player that raised the eventnewCache
- percentage complete, ranging from 0.0 to 100.0
-
playing
public void playing(MediaPlayer mediaPlayer)
Description copied from interface:MediaPlayerEventListener
The media started playing.There is no guarantee that a video output has been created at this point.
- Specified by:
playing
in interfaceMediaPlayerEventListener
- Parameters:
mediaPlayer
- media player that raised the event
-
paused
public void paused(MediaPlayer mediaPlayer)
Description copied from interface:MediaPlayerEventListener
Media paused.- Specified by:
paused
in interfaceMediaPlayerEventListener
- Parameters:
mediaPlayer
- media player that raised the event
-
stopped
public void stopped(MediaPlayer mediaPlayer)
Description copied from interface:MediaPlayerEventListener
Media stopped.A stopped event may be raised under certain circumstances even if the media player is not playing (e.g. as part of the associated media list player sub-item handling). Client applications must therefore be prepared to handle such a situation.
- Specified by:
stopped
in interfaceMediaPlayerEventListener
- Parameters:
mediaPlayer
- media player that raised the event
-
forward
public void forward(MediaPlayer mediaPlayer)
Description copied from interface:MediaPlayerEventListener
Media skipped forward.- Specified by:
forward
in interfaceMediaPlayerEventListener
- Parameters:
mediaPlayer
- media player that raised the event
-
backward
public void backward(MediaPlayer mediaPlayer)
Description copied from interface:MediaPlayerEventListener
Media skipped backward.- Specified by:
backward
in interfaceMediaPlayerEventListener
- Parameters:
mediaPlayer
- media player that raised the event
-
finished
public void finished(MediaPlayer mediaPlayer)
Description copied from interface:MediaPlayerEventListener
Media finished playing (i.e. the end was reached without being stopped).- Specified by:
finished
in interfaceMediaPlayerEventListener
- Parameters:
mediaPlayer
- media player that raised the event
-
timeChanged
public void timeChanged(MediaPlayer mediaPlayer, long newTime)
Description copied from interface:MediaPlayerEventListener
Media play-back time changed.- Specified by:
timeChanged
in interfaceMediaPlayerEventListener
- Parameters:
mediaPlayer
- media player that raised the eventnewTime
- new time
-
positionChanged
public void positionChanged(MediaPlayer mediaPlayer, float newPosition)
Description copied from interface:MediaPlayerEventListener
Media play-back position changed.- Specified by:
positionChanged
in interfaceMediaPlayerEventListener
- Parameters:
mediaPlayer
- media player that raised the eventnewPosition
- percentage between 0.0 and 1.0
-
seekableChanged
public void seekableChanged(MediaPlayer mediaPlayer, int newSeekable)
Description copied from interface:MediaPlayerEventListener
Media seekable status changed.- Specified by:
seekableChanged
in interfaceMediaPlayerEventListener
- Parameters:
mediaPlayer
- media player that raised the eventnewSeekable
- new seekable status
-
pausableChanged
public void pausableChanged(MediaPlayer mediaPlayer, int newSeekable)
Description copied from interface:MediaPlayerEventListener
Media pausable status changed.- Specified by:
pausableChanged
in interfaceMediaPlayerEventListener
- Parameters:
mediaPlayer
- media player that raised the eventnewSeekable
- new pausable status
-
titleChanged
public void titleChanged(MediaPlayer mediaPlayer, int newTitle)
Description copied from interface:MediaPlayerEventListener
Media title changed.- Specified by:
titleChanged
in interfaceMediaPlayerEventListener
- Parameters:
mediaPlayer
- media player that raised the eventnewTitle
- new title
-
snapshotTaken
public void snapshotTaken(MediaPlayer mediaPlayer, String filename)
Description copied from interface:MediaPlayerEventListener
A snapshot was taken.- Specified by:
snapshotTaken
in interfaceMediaPlayerEventListener
- Parameters:
mediaPlayer
- media player that raised the eventfilename
- name of the file containing the snapshot
-
lengthChanged
public void lengthChanged(MediaPlayer mediaPlayer, long newLength)
Description copied from interface:MediaPlayerEventListener
Media length changed.- Specified by:
lengthChanged
in interfaceMediaPlayerEventListener
- Parameters:
mediaPlayer
- media player that raised the eventnewLength
- new length (number of milliseconds)
-
videoOutput
public void videoOutput(MediaPlayer mediaPlayer, int newCount)
Description copied from interface:MediaPlayerEventListener
The number of video outputs changed.- Specified by:
videoOutput
in interfaceMediaPlayerEventListener
- Parameters:
mediaPlayer
- media player that raised the eventnewCount
- new number of video outputs
-
scrambledChanged
public void scrambledChanged(MediaPlayer mediaPlayer, int newScrambled)
Description copied from interface:MediaPlayerEventListener
Program scrambled changed.- Specified by:
scrambledChanged
in interfaceMediaPlayerEventListener
- Parameters:
mediaPlayer
- media player that raised the eventnewScrambled
- new scrambled value
-
elementaryStreamAdded
public void elementaryStreamAdded(MediaPlayer mediaPlayer, TrackType type, int id)
Description copied from interface:MediaPlayerEventListener
An elementary stream was added.- Specified by:
elementaryStreamAdded
in interfaceMediaPlayerEventListener
- Parameters:
mediaPlayer
- media player that raised the eventtype
- type of streamid
- identifier of stream
-
elementaryStreamDeleted
public void elementaryStreamDeleted(MediaPlayer mediaPlayer, TrackType type, int id)
Description copied from interface:MediaPlayerEventListener
An elementary stream was deleted.- Specified by:
elementaryStreamDeleted
in interfaceMediaPlayerEventListener
- Parameters:
mediaPlayer
- media player that raised the eventtype
- type of streamid
- identifier of stream
-
elementaryStreamSelected
public void elementaryStreamSelected(MediaPlayer mediaPlayer, TrackType type, int id)
Description copied from interface:MediaPlayerEventListener
An elementary stream was selected.- Specified by:
elementaryStreamSelected
in interfaceMediaPlayerEventListener
- Parameters:
mediaPlayer
- media player that raised the eventtype
- type of streamid
- identifier of stream
-
corked
public void corked(MediaPlayer mediaPlayer, boolean corked)
Description copied from interface:MediaPlayerEventListener
The media player was corked/un-corked.Corking/un-corking can occur e.g. when another media player (or some other application) starts/stops playing media.
- Specified by:
corked
in interfaceMediaPlayerEventListener
- Parameters:
mediaPlayer
- media player that raised the eventcorked
-true
if corked; otherwisefalse
-
muted
public void muted(MediaPlayer mediaPlayer, boolean muted)
Description copied from interface:MediaPlayerEventListener
The audio was muted/un-muted.- Specified by:
muted
in interfaceMediaPlayerEventListener
- Parameters:
mediaPlayer
- media player that raised the eventmuted
-true
if muted; otherwisefalse
-
volumeChanged
public void volumeChanged(MediaPlayer mediaPlayer, float volume)
Description copied from interface:MediaPlayerEventListener
The volume changed.- Specified by:
volumeChanged
in interfaceMediaPlayerEventListener
- Parameters:
mediaPlayer
- media player that raised the eventvolume
- new volume
-
audioDeviceChanged
public void audioDeviceChanged(MediaPlayer mediaPlayer, String audioDevice)
Description copied from interface:MediaPlayerEventListener
The audio device changed.- Specified by:
audioDeviceChanged
in interfaceMediaPlayerEventListener
- Parameters:
mediaPlayer
- media player that raised the eventaudioDevice
- new audio device
-
chapterChanged
public void chapterChanged(MediaPlayer mediaPlayer, int newChapter)
Description copied from interface:MediaPlayerEventListener
The chapter changed.- Specified by:
chapterChanged
in interfaceMediaPlayerEventListener
- Parameters:
mediaPlayer
- media player that raised the eventnewChapter
- new chapter
-
error
public void error(MediaPlayer mediaPlayer)
Description copied from interface:MediaPlayerEventListener
An error occurred.- Specified by:
error
in interfaceMediaPlayerEventListener
- Parameters:
mediaPlayer
- media player that raised the event
-
mediaPlayerReady
public void mediaPlayerReady(MediaPlayer mediaPlayer)
Description copied from interface:MediaPlayerEventListener
Media player is ready (to enable features like logo and marquee) after the media has started playing.The implementation will fire this event once on receipt of the first native position-changed event with a position value greater than zero.
The event will be fired again if the media is played again after a native stopped or finished event is received.
Waiting for this event may be more reliable than using
MediaPlayerEventListener.playing(MediaPlayer)
orMediaPlayerEventListener.videoOutput(MediaPlayer, int)
in some cases (logo and marquee already mentioned, also setting audio tracks, sub-title tracks and so on).- Specified by:
mediaPlayerReady
in interfaceMediaPlayerEventListener
- Parameters:
mediaPlayer
- media player that raised the event
-
mediaMetaChanged
public void mediaMetaChanged(Media media, Meta metaType)
Description copied from interface:MediaEventListener
Current media meta data changed.- Specified by:
mediaMetaChanged
in interfaceMediaEventListener
- Parameters:
media
- media that raised the eventmetaType
- type of meta data that changed
-
mediaSubItemAdded
public void mediaSubItemAdded(Media media, MediaRef newChild)
Description copied from interface:MediaEventListener
A new sub-item was added to the current media.- Specified by:
mediaSubItemAdded
in interfaceMediaEventListener
- Parameters:
media
- media that raised the eventnewChild
- native sub-item handle
-
mediaDurationChanged
public void mediaDurationChanged(Media media, long newDuration)
Description copied from interface:MediaEventListener
The current media duration changed.- Specified by:
mediaDurationChanged
in interfaceMediaEventListener
- Parameters:
media
- media that raised the eventnewDuration
- new duration (number of milliseconds)
-
mediaParsedChanged
public void mediaParsedChanged(Media media, MediaParsedStatus newStatus)
Description copied from interface:MediaEventListener
The current media parsed status changed.- Specified by:
mediaParsedChanged
in interfaceMediaEventListener
- Parameters:
media
- media that raised the eventnewStatus
- new parsed status
-
mediaFreed
public void mediaFreed(Media media, MediaRef mediaFreed)
Description copied from interface:MediaEventListener
The current media was freed.- Specified by:
mediaFreed
in interfaceMediaEventListener
- Parameters:
media
- media that raised the event
-
mediaStateChanged
public void mediaStateChanged(Media media, State newState)
Description copied from interface:MediaEventListener
The current media state changed.- Specified by:
mediaStateChanged
in interfaceMediaEventListener
- Parameters:
media
- media that raised the eventnewState
- new state
-
mediaSubItemTreeAdded
public void mediaSubItemTreeAdded(Media media, MediaRef item)
Description copied from interface:MediaEventListener
A sub-item tree was added to the media.- Specified by:
mediaSubItemTreeAdded
in interfaceMediaEventListener
- Parameters:
media
- media that raised the eventitem
- media item
-
mediaThumbnailGenerated
public void mediaThumbnailGenerated(Media media, Picture picture)
- Specified by:
mediaThumbnailGenerated
in interfaceMediaEventListener
-
mouseClicked
public void mouseClicked(MouseEvent e)
- Specified by:
mouseClicked
in interfaceMouseListener
-
mousePressed
public void mousePressed(MouseEvent e)
- Specified by:
mousePressed
in interfaceMouseListener
-
mouseReleased
public void mouseReleased(MouseEvent e)
- Specified by:
mouseReleased
in interfaceMouseListener
-
mouseEntered
public void mouseEntered(MouseEvent e)
- Specified by:
mouseEntered
in interfaceMouseListener
-
mouseExited
public void mouseExited(MouseEvent e)
- Specified by:
mouseExited
in interfaceMouseListener
-
mouseDragged
public void mouseDragged(MouseEvent e)
- Specified by:
mouseDragged
in interfaceMouseMotionListener
-
mouseMoved
public void mouseMoved(MouseEvent e)
- Specified by:
mouseMoved
in interfaceMouseMotionListener
-
mouseWheelMoved
public void mouseWheelMoved(MouseWheelEvent e)
- Specified by:
mouseWheelMoved
in interfaceMouseWheelListener
-
keyTyped
public void keyTyped(KeyEvent e)
- Specified by:
keyTyped
in interfaceKeyListener
-
keyPressed
public void keyPressed(KeyEvent e)
- Specified by:
keyPressed
in interfaceKeyListener
-
keyReleased
public void keyReleased(KeyEvent e)
- Specified by:
keyReleased
in interfaceKeyListener
-
-