APIdia Launch Partner
Top Description Inners Fields Constructors Methods
com.sun.media.jfxmediaimpl

public abstract Class NativeMediaPlayer

Additional top-level class in compilation unit: MediaPulseTask.

extends Object
implements MediaPlayer, MarkerStateListener
Class Inheritance
All Implemented Interfaces
com.sun.media.jfxmediaimpl.MarkerStateListener, com.sun.media.jfxmedia.MediaPlayer
Known Direct Subclasses
com.sun.media.jfxmediaimpl.platform.gstreamer.GSTMediaPlayer, com.sun.media.jfxmediaimpl.platform.ios.IOSMediaPlayer, com.sun.media.jfxmediaimpl.platform.osx.OSXMediaPlayer
Imports
java.lang.annotation.Native, com.sun.media.jfxmedia.Media, .MediaError, .MediaException, .MediaPlayer, com.sun.media.jfxmedia.control.VideoRenderControl, com.sun.media.jfxmedia.effects.AudioEqualizer, .AudioSpectrum, com.sun.media.jfxmedia.events.AudioSpectrumEvent, .AudioSpectrumListener, .BufferListener, .BufferProgressEvent, .MarkerEvent, .MarkerListener, .MediaErrorListener, .NewFrameEvent, .PlayerEvent, .PlayerStateEvent, .PlayerStateEvent.PlayerState, .PlayerStateListener, .PlayerTimeListener, .VideoFrameRateListener, .VideoRendererListener, .VideoTrackSizeListener, com.sun.media.jfxmedia.logging.Logger, com.sun.media.jfxmedia.track.AudioTrack, .SubtitleTrack, .Track, .Track.Encoding, .VideoResolution, .VideoTrack, java.lang.ref.WeakReference, java.util.*, java.util.concurrent.BlockingQueue, .LinkedBlockingQueue, java.util.concurrent.atomic.AtomicBoolean, java.util.concurrent.locks.Lock, .ReentrantLock

Base implementation of a MediaPlayer.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
NativeMediaPlayer.EventQueueThread

Thread for media player event processing.

private static class
public static class
NativeMediaPlayer.MediaErrorEvent

Event to be posted to any registered (@link MediaErrorListener)s

private static class
private static class
NativeMediaPlayer.TrackEvent

Event to be posted to any registered PlayerStateListeners.

private class
private static class
NativeMediaPlayer.WarningEvent

Event to be posted to any registered MediaErrorListeners.

Field Summary

Modifier and TypeField and Description
private final List<WeakReference<AudioSpectrumListener>>
private final List<WeakReference<BufferListener>>
private final List<BufferProgressEvent>
private final List<NativeMediaPlayer.MediaErrorEvent>
private final List<PlayerStateEvent>
private final List<NativeMediaPlayer.PlayerTimeEvent>
private boolean
private double
private final Lock
private double
private final List<WeakReference<MediaErrorListener>>
private NativeMediaPlayer.EventQueueThread
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
private double
private NewFrameEvent
private final Object
private double
private int
private int
private boolean
private boolean
private final AtomicBoolean
private boolean
private boolean
private final List<WeakReference<MarkerListener>>
private final Lock
private double
private NativeMedia
media

The Media corresponding to the media source.

private final Lock
private Timer
private static final int
private long
private Runnable
public static final long
private PlayerStateEvent.PlayerState
private final List<WeakReference<PlayerStateListener>>
private final List<WeakReference<PlayerTimeListener>>
private double
private double
private boolean
private double
private double
private double
private double
private final List<WeakReference<VideoFrameRateListener>>
private VideoRenderControl
private final List<WeakReference<VideoTrackSizeListener>>
private final List<WeakReference<VideoRendererListener>>

Constructor Summary

AccessConstructor and Description
protected
NativeMediaPlayer(NativeMedia
Media object
clip
)

Construct a NativeMediaPlayer for the referenced clip.

Method Summary

Modifier and TypeMethod and Description
public void
public void
addBufferListener(BufferListener listener)

Implements com.sun.media.jfxmedia.MediaPlayer.addBufferListener.

Adds a listener for all buffer events.

public void
addMarkerListener(MarkerListener listener)

Implements com.sun.media.jfxmedia.MediaPlayer.addMarkerListener.

Adds a listener for marker events.

public void
addMediaErrorListener(MediaErrorListener listener)

Implements com.sun.media.jfxmedia.MediaPlayer.addMediaErrorListener.

Adds a listener for warnings which occur within the lifespan of the player.

public void
public void
addMediaTimeListener(PlayerTimeListener listener)

Implements com.sun.media.jfxmedia.MediaPlayer.addMediaTimeListener.

Adds a listener for player time events.

public void
addVideoTrackSizeListener(VideoTrackSizeListener listener)

Implements com.sun.media.jfxmedia.MediaPlayer.addVideoTrackSizeListener.

Adds a listener for video track frame dimensions.

private void
protected AudioEqualizer
protected AudioSpectrum
createNativeAudioSpectrum(long nativeRef)

private void
public final void
dispose()

Implements com.sun.media.jfxmedia.MediaPlayer.dispose.

Release any resources held by this player.

pack-priv boolean
public abstract AudioSpectrum
getAudioSpectrum()

Redeclares com.sun.media.jfxmedia.MediaPlayer.getAudioSpectrum.

Gets the audio spectrum controller for the player.

public long
getAudioSyncDelay()

Implements com.sun.media.jfxmedia.MediaPlayer.getAudioSyncDelay.

Retrieve the audio rendering delay.

public float
getBalance()

Implements com.sun.media.jfxmedia.MediaPlayer.getBalance.

Gets the current balance.

public double
getDuration()

Implements com.sun.media.jfxmedia.MediaPlayer.getDuration.

Gets the duration in seconds.

public abstract AudioEqualizer
getEqualizer()

Redeclares com.sun.media.jfxmedia.MediaPlayer.getEqualizer.

Gets the audio equalizer for the player.

public Media
getMedia()

Implements com.sun.media.jfxmedia.MediaPlayer.getMedia.

Gets a Media object.

public boolean
getMute()

Implements com.sun.media.jfxmedia.MediaPlayer.getMute.

Gets the muted state.

public double
getPresentationTime()

Implements com.sun.media.jfxmedia.MediaPlayer.getPresentationTime.

Gets the current presentation time.

public float
getRate()

Implements com.sun.media.jfxmedia.MediaPlayer.getRate.

Get the rate of playback.

public double
getStartTime()

Implements com.sun.media.jfxmedia.MediaPlayer.getStartTime.

Gets the time within the duration of the media to start playing.

public PlayerStateEvent.PlayerState

Returns:

the current player state.
getState
()

Implements com.sun.media.jfxmedia.MediaPlayer.getState.

Retrieves the current state of the player.

public double
getStopTime()

Implements com.sun.media.jfxmedia.MediaPlayer.getStopTime.

Gets the time within the duration of the media to stop playing.

public VideoRenderControl
getVideoRenderControl()

Implements com.sun.media.jfxmedia.MediaPlayer.getVideoRenderControl.

Returns the video rendering support interface.

public float
getVolume()

Implements com.sun.media.jfxmedia.MediaPlayer.getVolume.

Gets the current volume.

protected void
init()

Initialization method which must be called after construction to initialize the internal state of the player.

public boolean
isErrorEventCached()

Implements com.sun.media.jfxmedia.MediaPlayer.isErrorEventCached.

Returns true if we have cached error event.

public void
private synchronized void
onNativeInit()

Internal function to get called when the native player is ready.

public void
pause()

Implements com.sun.media.jfxmedia.MediaPlayer.pause.

Pauses the media playing.

public void
play()

Implements com.sun.media.jfxmedia.MediaPlayer.play.

Begins playing of the media.

protected abstract void
protected abstract void
protected abstract long
protected abstract float
protected abstract double
protected abstract boolean
protected abstract double
protected abstract float
protected abstract float
protected abstract void
protected abstract void
protected abstract void
protected abstract void
playerSeek(double streamTime)

protected abstract void
protected abstract void
playerSetBalance(float balance)

protected abstract void
playerSetMute(boolean state)

protected abstract void
playerSetRate(float rate)

protected abstract void
playerSetVolume(float volume)

protected abstract void
public void
public void
removeBufferListener(BufferListener listener)

Implements com.sun.media.jfxmedia.MediaPlayer.removeBufferListener.

Removes a listener for buffer events.

public void
removeMarkerListener(MarkerListener listener)

Implements com.sun.media.jfxmedia.MediaPlayer.removeMarkerListener.

Removes a listener for marker events.

public void
public void
public void
removeMediaTimeListener(PlayerTimeListener listener)

Implements com.sun.media.jfxmedia.MediaPlayer.removeMediaTimeListener.

Removes a listener for player time events.

public void
removeVideoTrackSizeListener(VideoTrackSizeListener listener)

Implements com.sun.media.jfxmedia.MediaPlayer.removeVideoTrackSizeListener.

Removes a listener for video track frame dimensions.

public void
seek(double streamTime)

Implements com.sun.media.jfxmedia.MediaPlayer.seek.

Seeks playback to the specified time.

protected void
sendAudioSpectrumEvent(double timestamp, double duration, boolean queryTimestamp)

protected void
sendAudioTrack(boolean enabled, long trackID, String name, int encoding, String language, int numChannels, int channelMask, float sampleRate)

protected void
sendBufferProgressEvent(double clipDuration, long bufferStart, long bufferStop, long bufferPosition)

protected void
sendDurationUpdateEvent(double duration)

protected void
sendFrameSizeChangedEvent(int width, int height)

protected void
sendMarkerEvent(String name, double time)

protected void
sendNewFrameEvent(long nativeRef)

protected void
protected void
sendPlayerHaltEvent(String message, double time)

protected void
protected void
sendPlayerStateEvent(int eventID, double time)

protected void
sendSubtitleTrack(boolean enabled, long trackID, String name, int encoding, String language)

protected void
sendVideoTrack(boolean enabled, long trackID, String name, int encoding, int width, int height, float frameRate, boolean hasAlphaChannel)

protected void
sendWarning(int warningCode, String warningMessage)

public void
setAudioSyncDelay(long delay)

Implements com.sun.media.jfxmedia.MediaPlayer.setAudioSyncDelay.

Set the amount of time to delay the audio.

public void
setBalance(float bal)

Implements com.sun.media.jfxmedia.MediaPlayer.setBalance.

Sets the balance.

public void
setMute(boolean enable)

Implements com.sun.media.jfxmedia.MediaPlayer.setMute.

Enables/disable mute.

pack-priv void
setOnDispose(Runnable
object on which to invoke Runnable#run() in dispose().
onDispose
)

Set a callback to invoke when the player is disposed.

public void
setRate(float rate)

Implements com.sun.media.jfxmedia.MediaPlayer.setRate.

Sets the rate of playback.

public void
setStartTime(double startTime)

Implements com.sun.media.jfxmedia.MediaPlayer.setStartTime.

Sets the start time within the media to play.

public void
setStopTime(double stopTime)

Implements com.sun.media.jfxmedia.MediaPlayer.setStopTime.

Sets the stop time within the media to stop playback.

public void
setVolume(float vol)

Implements com.sun.media.jfxmedia.MediaPlayer.setVolume.

Sets the volume.

public void
stop()

Implements com.sun.media.jfxmedia.MediaPlayer.stop.

Stops playing of the media and resets the play time to 0.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait