Spec-Zone .ru
спецификации, руководства, описания, API

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

Profile: desktop, common

Overview

The MediaPlayer class provides the controls for playing media. It is used in combination with the Media and MediaViewer classes to display and control media playing. Note that the MediaPlayer does not contain any visual elements so must be used with the MediaView class to view the media.

See Also:
Media, MediaView

Profile: common

Script Variable Summary

access name type Can Read Can Init Can Write Default Value description
public BUFFERING Integer

Status value when player is buffering.

Status value when player is buffering. Buffering may occur when player is paused or playing

Profile: common

 
public-read PAUSED Integer

Status value when player is paused

public PLAYING Integer

status value when player is playing

public REPEAT_FOREVER Integer

Value of repeatCount to repeat forever

public REPEAT_NONE Number

Value of repeatCount for no repeating (play once)

public STALLED Integer

Status value when player is stalled.

Status value when player is stalled. STALLED occurs when media is being played, but data is not being delivered fast enough to continue playing

See Also:
onStalled

Profile: common

 

Variable Summary

access name type Can Read Can Init Can Write Default Value description
public autoPlay Boolean

If autoPlay is true, playing will start as soon as possible

public balance Number

Defines the balance, or left right setting, of the audio output.

Defines the balance, or left right setting, of the audio output. Value ranges continuously from -1.0 being left, 0 being center, and 1.0 being right.

Profile: common

 
public-read bufferProgressTime Duration

For a bufferred stream, the current buffer position which indicates how much media can be played without stalling the MediaPlayer.

public currentCount Number

Defines the current number of time the media has repeated

public currentTime Duration

The current media time, may be read to indicate the current position or written to cause the media to seek to the set position.

The current media time, may be read to indicate the current position or written to cause the media to seek to the set position. Note that since the variable is being updated by the JavaFX rutime, bind with inverse must be used if it is being bound from another variable.

Profile: common

 
public enabledTracks Track[]

The sequence of tracks that are currently enabled on this MediaPlayer To enable or disable tracks, a Track is respctively added or removed from this sequence.

public fader Number

The fader, or forward and back setting, of audio output on 4+ channel output.

The fader, or forward and back setting, of audio output on 4+ channel output. value ranges continuously from -1.0 being rear, 0 being center, and 1.0 being forward.

Profile: common

 
public media Media

Defines the source Media to be played

public mute Boolean

Equals true if the player's audio is muted, false otherwise.

public onBuffering function(:Duration):Void

Invoked when the player is buffering data.

Invoked when the player is buffering data. timeRemaining is an estimate of how much time it will take before the mediaPlayer can play the media

Profile: common

 
public onEndOfMedia function():Void

Invoked when the player reaches the end of media

public onError function(:MediaError):Void

The onError function is called when a mediaError occurs on this player.

The onError function is called when a mediaError occurs on this player. Note that onError shoudl be intitialized before other variables so that errors can be handled appropriately.

See Also:
MediaError

Profile: common

 
public onRepeat function():Void

Invoked when the player reaches the end of media.

public onStalled function(:Duration):Void

Invoked when the player has stalled because it was not receiving data fast enough to continue playing.

Invoked when the player has stalled because it was not receiving data fast enough to continue playing. timeRemaining is an estimate of how much time it will take before the mediaPlayer can continue playing.

Profile: common

 
public paused Boolean

Indicated if the player has been paused, either programatically, by the user, or because the media has finished playing

public rate Number

Defines the rate at which the media is being played.

Defines the rate at which the media is being played. Rate 1.0 is normal play, 2.0 is 2 time normal, -1.0 is backwards. Note that all media formats do not support playing backwards or arbitrary rates.

Profile: common

 
public repeatCount Number

Defines the number of times the media should repeat.

Defines the number of times the media should repeat. if repeatCount is 1 the media will play once. if it is REPEAT_FOREVER, it will repeat indefinitely

Profile: common

 
public startTime Duration

Defines the time offset where media should start playing, or restart from when repeating

public status Integer

Reflects the current status of the MediaPlayer.

Reflects the current status of the MediaPlayer. The status is one of PAUSED: The player has been paused PLAYING: The player is playing BUFFERING: This may occur when player is paused or playing STALLED : Occurs when media is being played, but data is not being delivered fast enough to continue playing

Profile: common

 
public stopTime Duration

Defines the time offset where media should stop playing or restart when repeating

public-read supportsMultiViews Boolean

Indicates if this player can have multiple views associated with it.

public timers MediaTimer[]

the sequence media timers for this player.

the sequence media timers for this player. For each Timer in this sequence, its action function will be invoked when the time is reached by this MediaPlayer

See Also:
MediaTimer

Profile: common

 
public volume Number

Defines the volume at which the media is being played.

Defines the volume at which the media is being played. 1.0 is full volume, which is the default.

Profile: common

 

Inherited Variables

Function Summary

public pause() : Boolean

Pauses playing

Pauses playing

Returns
Boolean

Profile: common

 
public play() : Boolean

Starts or resumes playing

Starts or resumes playing

Returns
Boolean

Profile: common

 
public stop() : Number

Stops playing, resets to beginning of media, and resets the play count

Stops playing, resets to beginning of media, and resets the play count

Returns
Number

Profile: common

 

Inherited Functions