JavaFX: Bringing Rich Experiences To All the Screens Of Your Life

expand all

Profile: desktop, common

Overview

The Media class represents a media resource. It contains information about the media such as its source URI, duration, resolution, and metadata.

See Also:
MediaError

Profile: common

Variable Summary

accessnametypeCan ReadCan InitCan WriteDefault Valuedescription
public-readdurationDuration

The duration in seconds of the source media.

The duration in seconds of the source media. If the media duration is unknown then this property will be less than zero.

Profile: common

 
public-readheightNumber

The height of the source media specified in pixels.

The height of the source media specified in pixels. This may be zero if the media has no height, e.g., when playing audio, or if the height is currently unknown which may occur with streaming media.

See Also:
width

Profile: common

 
public-readmetadataMetadata[]

A sequence of Metadata objects which can contain information about the media.

publiconErrorfunction(:MediaError):Void

The function to be invoked when an error occurs on this Media object.

The function to be invoked when an error occurs on this Media object. Note that onError should be initialized before setting the source of the media to ensure that the errors can be handled appropriately.

See Also:
MediaError

Profile: common

 
public-initsourceString

Defines the String which specifies the URI of the media; It must be an absolute URI, such as "file:///media.fxm".

Defines the String which specifies the URI of the media; It must be an absolute URI, such as "file:///media.fxm". If it is relative to the codebase then __DIR__ may be used, as in "{__DIR__}/media.fxm".

Constraints:
The supplied URI must conform to RFC-2396 as required by java.net.URI
Only "file" and "http" URIs are supported.

See java.net.URI for more information about URI formatting.

Profile: common

 
public-readtracksTrack[]

A Sequence of tracks contained in this media object.

A Sequence of tracks contained in this media object. A Media object can contain multiple tracks, such as a video track with several audio and subtitle tracks.

See Also:
Track

Profile: common

 
public-readwidthNumber

The width of the source media specified in pixels.

The width of the source media specified in pixels. This may be zero if the media has no width, e.g., when playing audio, or if the width is currently unknown which may occur with streaming media.

See Also:
height

Profile: common

 

Inherited Variables

Function Summary

public getMetadata(key: java.lang.String) : java.lang.Object

Returns the metadata stored in the source media for the specified key.

Returns the metadata stored in the source media for the specified key.

See Also:
metadata

Parameters
key
the name of the key, such as "author"
Returns
Object
the Object for the specided key. The class of this is often a String but could be another class depending on the media type and the key value. Note that metadata may not be available for all media types.

Profile: common

 

Inherited Functions