Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: MediaView

[34:7] extends: Node

Wraps JavaFX MediaView, a node that provides a view of media being played by a MediaPlayer. The view displays the video track of the associated player and can be sized independently of the media's native resolution. MediaView has no class-specific CSS properties beyond those inherited from Node.

CSS Properties -- Node

Property Values Default Description
-fx-blend-mode add | blue | color-burn | color-dodge | darken | difference | exclusion | green | hard-light | lighten | multiply | overlay | red | screen | soft-light | src-atop | src-in | src-out | src-over null Blend mode used when compositing this node with nodes beneath it.
-fx-cursor null | crosshair | default | hand | move | e-resize | h-resize | ne-resize | nw-resize | n-resize | se-resize | sw-resize | s-resize | w-resize | v-resize | text | wait | <url> null (inherits) Mouse cursor shape shown when the pointer is over this node. Inherits from parent by default.
-fx-effect <effect> null A visual effect (e.g. DropShadow, InnerShadow) applied to the rendered node.
-fx-focus-traversable true | false false Whether this node participates in focus traversal.
-fx-view-order <number> 0 Adjusts rendering and hit-test order within the parent without changing the scene graph order.
-fx-opacity <number> [0.0 - 1.0] 1 Opacity of the node. 0 is fully transparent, 1 is fully opaque.
-fx-rotate <number> 0 Rotation angle in degrees applied around the node's center point.
-fx-scale-x <number> 1 Scale factor along the X axis about the node's center.
-fx-scale-y <number> 1 Scale factor along the Y axis about the node's center.
-fx-scale-z <number> 1 Scale factor along the Z axis about the node's center.
-fx-translate-x <number> 0 Translation offset along the X axis in pixels.
-fx-translate-y <number> 0 Translation offset along the Y axis in pixels.
-fx-translate-z <number> 0 Translation offset along the Z axis in pixels.
visibility visible | hidden | collapse | inherit visible Controls whether the node is rendered and participates in layout.
-fx-managed true | false true When false, the parent layout does not manage this node's position or size.

Methods

  • MediaView (object PlayerObj = null)

    Creates a new MediaView optionally bound to the given MediaPlayer.

    • @p PlayerObj is a MediaPlayer object whose video will be displayed, or null for no player.
  • setMediaPlayer (object PlayerObj)

    Sets the MediaPlayer that provides the media to display.

    • @p PlayerObj is a MediaPlayer object whose video track will be rendered by this view.
    • @r this object
  • setFitWidth (double W)

    Sets the width to which the video is scaled when displayed.

    • @p W is a double with the fit width in pixels; 0 uses the media's natural width.
    • @r this object
  • setFitHeight (double H)

    Sets the height to which the video is scaled when displayed.

    • @p H is a double with the fit height in pixels; 0 uses the media's natural height.
    • @r this object
  • getMediaPlayer ()

    Returns the MediaPlayer that provides this view's media.

    • @r An AJO holding the MediaPlayer, or null.
  • mediaPlayerProperty ()

    Returns the property holding the MediaPlayer.

    • @r An ObjectProperty AJO holding the MediaPlayer.
  • setOnError (callback Cb)

    Sets a callback that fires when the view reports a media error.

    • @p Cb is a callback that receives the MediaErrorEvent.
    • @r this object
  • getOnError ()

    Returns the current onError handler.

    • @r An AJO holding the EventHandler, or null.
  • onErrorProperty ()

    Returns the property holding the onError handler.

    • @r An ObjectProperty AJO holding the EventHandler.
  • setPreserveRatio (bool Preserve)

    Sets whether the view preserves the media's aspect ratio when scaled.

    • @p Preserve is a bool; true keeps the aspect ratio.
    • @r this object
  • isPreserveRatio ()

    Returns whether the view preserves the media's aspect ratio.

    • @r A bool with true when the aspect ratio is preserved.
  • preserveRatioProperty ()

    Returns the property holding the preserveRatio flag.

    • @r A BooleanProperty AJO.
  • setSmooth (bool Smooth)

    Sets whether the view applies a smoothing filter when scaling video.

    • @p Smooth is a bool; true enables smoothing.
    • @r this object
  • isSmooth ()

    Returns whether smoothing is enabled.

    • @r A bool with true when smoothing is enabled.
  • smoothProperty ()

    Returns the property holding the smooth flag.

    • @r A BooleanProperty AJO.
  • setX (double V)

    Sets the X coordinate of the view's upper-left corner.

    • @p V is a double with the new X.
    • @r this object
  • getX ()

    Returns the X coordinate of the view's upper-left corner.

    • @r A double with the X coordinate.
  • xProperty ()

    Returns the property holding the X coordinate.

    • @r A DoubleProperty AJO.
  • setY (double V)

    Sets the Y coordinate of the view's upper-left corner.

    • @p V is a double with the new Y.
    • @r this object
  • getY ()

    Returns the Y coordinate of the view's upper-left corner.

    • @r A double with the Y coordinate.
  • yProperty ()

    Returns the property holding the Y coordinate.

    • @r A DoubleProperty AJO.
  • getFitWidth ()

    Returns the fit width in pixels.

    • @r A double with the fit width.
  • fitWidthProperty ()

    Returns the property holding the fit width.

    • @r A DoubleProperty AJO.
  • getFitHeight ()

    Returns the fit height in pixels.

    • @r A double with the fit height.
  • fitHeightProperty ()

    Returns the property holding the fit height.

    • @r A DoubleProperty AJO.
  • setViewport (object ViewportObj)

    Sets the viewport rectangle that crops the source media before display.

    • @p ViewportObj is an AJO holding a javafx.geometry.Rectangle2D.
    • @r this object
  • getViewport ()

    Returns the viewport rectangle, or null when none is set.

    • @r An AJO holding the Rectangle2D, or null.
  • viewportProperty ()

    Returns the property holding the viewport rectangle.

    • @r An ObjectProperty AJO holding the Rectangle2D.