Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: Media

[12:7] extends: FxObj

Wraps JavaFX Media, which represents a media resource (audio or video) loaded from a URI for playback through a MediaPlayer. The source must be a fully qualified URI string using the file:// scheme for local files or http:// for network streams. Once constructed, pass this object to a MediaPlayer to control playback.

Methods

  • Media (string Source)

    Creates a new Media object from the given URI string.

    • @p Source is a string with the media URI, e.g., file:///path/to/file.mp4.
    • @r this object
  • getSource ()

    Returns the source URI string used to create this Media object.

    • @r A string with the source URI.
  • getWidth ()

    Returns the width in pixels of the video, or 0 for audio-only media.

    • @r An int with the video width.
  • getHeight ()

    Returns the height in pixels of the video, or 0 for audio-only media.

    • @r An int with the video height.
  • getDuration ()

    Returns the duration of the media in milliseconds.

    • @r A double with the duration in milliseconds.