Class UIMediaEvent

All Implemented Interfaces:
IMessageBox

public class UIMediaEvent extends UIBaseEvent<UIMedia>
The UI Media Event is fired when the Media component for Audio or Video issues an event.

The following events are fired, and are defined in the

invalid @link
{@link @Type
} enum:
  • loadstart
  • progress
  • suspend
  • abort
  • error
  • emptied
  • stalled
  • loadedmetadata
  • loadeddata
  • canplay
  • canplaythrough
  • playing
  • waiting
  • seeking
  • seeked
  • ended
  • durationchange
  • timeupdate
  • play
  • pause
  • ratechange
  • resize
  • volumechange
Author:
Christopher Mindus
  • Field Details

    • HAVE_NOTHING

      public static final int HAVE_NOTHING
      Read state value (=0): no information whether or not the audio/video is ready.
      See Also:
    • HAVE_METADATA

      public static final int HAVE_METADATA
      Ready state value (=1): metadata for the audio/video is ready.
      See Also:
    • HAVE_CURRENT_DATA

      public static final int HAVE_CURRENT_DATA
      Ready state value (=2): data for the current playback position is available, but not enough data to play next frame/millisecond.
      See Also:
    • HAVE_FUTURE_DATA

      public static final int HAVE_FUTURE_DATA
      Ready state value (=3): data for the current and at least the next frame/milliseconds is available.
      See Also:
    • HAVE_ENOUGH_DATA

      public static final int HAVE_ENOUGH_DATA
      Ready state value (=4): enough data available to start playing.
      See Also:
    • NETWORK_EMPTY

      public static final int NETWORK_EMPTY
      Network state value (=0): audio/video has not yet been initialized.
      See Also:
    • NETWORK_IDLE

      public static final int NETWORK_IDLE
      Network state value (=1): audio/video is active and has selected a resource, but is not using the network.
      See Also:
    • NETWORK_LOADING

      public static final int NETWORK_LOADING
      Network state value (=2): downloading data.
      See Also:
    • NETWORK_NO_SOURCE

      public static final int NETWORK_NO_SOURCE
      Network state value (=3): no audio/video source found.
      See Also:
  • Constructor Details

    • UIMediaEvent

      public UIMediaEvent(UIMedia source, PropCnr params)
      Constructs the event for a change without a trigger source.
      Parameters:
      source - The source media UI component.
      params - The property container with event details.
      Throws:
      NullPointerException - If the source or params is null.
  • Method Details

    • getType

      public UIMediaEvent.Type getType()
      Gets the event type.
      Returns:
      The media event type, or null if not a listener event, but rather an event induced by the remote player to the server in response to a remote request.
    • getSource

      public UIMedia getSource()
      Gets the UI media component that is the source of the event.
      Overrides:
      getSource in class BaseEvent<UIMedia>
      Returns:
      The UIMedia component.
    • getEventError

      public String getEventError()
      Gets the event error in case of API error. Do not confuse this with the UI media component 'error' state.
      Returns:
      The event error, of null for none.
    • getVolume

      public double getVolume()
      Gets the volume between 0 and 1.
      Returns:
      The volume, or -1d for none.
    • getDuration

      public double getDuration()
      Gets the duration of the media in seconds.
      Returns:
      The duration, or -1d for none.
    • getCurrentTime

      public double getCurrentTime()
      Gets the current time of the media player.
      Returns:
      The current time in seconds, or -1d for none.
    • isPaused

      public boolean isPaused()
      Gets the paused media flag.
      Returns:
      The paused flag.
    • isMuted

      public boolean isMuted()
      Gets the muted media flag.
      Returns:
      The muted flag.
    • isSeeking

      public boolean isSeeking()
      Gets the media seeking flag.
      Returns:
      The seeking flag.
    • getReadyState

      public int getReadyState()
      Gets the ready state of the media player.

      The values returned are:

      • HAVE_NOTHING = 0: no information whether or not the audio/video is ready.
      • HAVE_METADATA = 1: metadata for the audio/video is ready.
      • HAVE_CURRENT_DATA = 2: data for the current playback position is available, but not enough data to play next frame/millisecond.
      • HAVE_FUTURE_DATA = 3: data for the current and at least the next frame/milliseconds is available.
      • HAVE_ENOUGH_DATA = 4: enough data available to start playing.

      Typically, this value is changed upon the events UIMediaEvent.Type:

      • playing
      • waiting
      • ended
      • emptied
      • stalled
      Returns:
      The ready state, or zero for none.
    • getNetworkState

      public int getNetworkState()
      Gets the network state of the media player.

      The values returned are:

      Typically, this value is changed upon the events UIMediaEvent.Type:

      • playing
      • waiting
      • ended
      • emptied
      • stalled
      Returns:
      The network state.
    • hasControls

      public boolean hasControls()
      Gets if the media player has controls displayed or not.
      Returns:
      The controls usage flag.
    • getAutoPlay

      public boolean getAutoPlay()
      Gets the autoplay flag for the media player.
      Returns:
      The autoplay flag.
    • getPreLoad

      public boolean getPreLoad()
      Gets the preload flag for the media player.
      Returns:
      The preload flag.
    • getCurrentSource

      public String getCurrentSource()
      Gets the current source URL assigned to the media player.
      Returns:
      The URL or empty string for none.
    • getVideoWidth

      public int getVideoWidth()
      Gets the width of the video.
      Returns:
      The width, or zero for none.
    • getVideoHeight

      public int getVideoHeight()
      Gets the height of the video.
      Returns:
      The height, or zero for none.
    • getBuffered

      public UIMediaEvent.TimeRanges getBuffered()
      Gets the buffered TimeRanges.
      Returns:
      The time ranges instance, or null for none.
    • getPlayed

      public UIMediaEvent.TimeRanges getPlayed()
      Gets the played TimeRanges.
      Returns:
      The time ranges instance, or null for none.
    • equals

      public boolean equals(Object o)
      Checks if two objects are equal.
      Overrides:
      equals in class Object
      Parameters:
      o - The other object to compare with.
      Returns:
      The equality flag.
    • hashCode

      public int hashCode()
      Returns a hash code value for the object.
      Overrides:
      hashCode in class Object
      Returns:
      The hash code.
    • paramString

      protected String paramString()
      Returns the paramString.
      Overrides:
      paramString in class BaseEvent<UIMedia>