public abstract class NativeMediaPlayer extends Object implements MediaPlayer, MarkerStateListener
MediaPlayer.| Modifier and Type | Class and Description |
|---|---|
static class |
NativeMediaPlayer.MediaErrorEvent
Event to be posted to any registered (@link MediaErrorListener)s
|
| Modifier and Type | Field and Description |
|---|---|
static int |
eventPlayerError |
static int |
eventPlayerFinished |
static int |
eventPlayerPaused |
static int |
eventPlayerPlaying |
static int |
eventPlayerReady |
static int |
eventPlayerStalled |
static int |
eventPlayerStopped |
static int |
eventPlayerUnknown |
static long |
ONE_SECOND |
| Modifier | Constructor and Description |
|---|---|
protected |
NativeMediaPlayer(NativeMedia clip)
Construct a NativeMediaPlayer for the referenced clip.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAudioSpectrumListener(AudioSpectrumListener listener)
Adds a listener for audio spectrum events.
|
void |
addBufferListener(BufferListener listener)
Adds a listener for all buffer events.
|
void |
addMarkerListener(MarkerListener listener)
Adds a listener for marker events.
|
void |
addMediaErrorListener(MediaErrorListener listener)
Adds a listener for warnings which occur within the lifespan of the player.
|
void |
addMediaPlayerListener(PlayerStateListener listener)
Adds a listener for media state.
|
void |
addMediaTimeListener(PlayerTimeListener listener)
Adds a listener for player time events.
|
void |
addVideoTrackSizeListener(VideoTrackSizeListener listener)
Adds a listener for video track frame dimensions.
|
protected AudioEqualizer |
createNativeAudioEqualizer(long nativeRef) |
protected AudioSpectrum |
createNativeAudioSpectrum(long nativeRef) |
void |
dispose()
Release any resources held by this player.
|
abstract AudioSpectrum |
getAudioSpectrum()
Gets the audio spectrum controller for the player.
|
long |
getAudioSyncDelay()
Retrieve the audio rendering delay.
|
float |
getBalance()
Gets the current balance.
|
double |
getDuration()
Gets the duration in seconds.
|
abstract AudioEqualizer |
getEqualizer()
Gets the master audio equalizer for the player.
|
Media |
getMedia()
Gets a Media object.
|
boolean |
getMute()
Gets the muted state.
|
double |
getPresentationTime()
Gets the current presentation time.
|
float |
getRate()
Get the rate of playback.
|
double |
getStartTime()
Gets the time within the duration of the media to start playing.
|
PlayerStateEvent.PlayerState |
getState()
Retrieves the current
state of the player. |
double |
getStopTime()
Gets the time within the duration of the media to stop playing.
|
VideoRenderControl |
getVideoRenderControl()
Returns the video rendering support interface.
|
float |
getVolume()
Gets the current volume.
|
protected void |
init()
Initialization method which must be called after construction to
initialize the internal state of the player.
|
void |
markerStateChanged(boolean hasMarkers) |
void |
pause()
Pauses the media playing.
|
void |
play()
Begins playing of the media.
|
protected abstract void |
playerDispose() |
protected abstract void |
playerFinish() |
protected abstract long |
playerGetAudioSyncDelay() |
protected abstract float |
playerGetBalance() |
protected abstract double |
playerGetDuration() |
protected abstract boolean |
playerGetMute() |
protected abstract double |
playerGetPresentationTime() |
protected abstract float |
playerGetRate() |
protected abstract float |
playerGetVolume() |
protected abstract void |
playerInit() |
protected abstract void |
playerPause() |
protected abstract void |
playerPlay() |
protected abstract void |
playerSeek(double streamTime) |
protected abstract void |
playerSetAudioSyncDelay(long delay) |
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 |
playerStop() |
void |
removeAudioSpectrumListener(AudioSpectrumListener listener)
Removes a listener for audio spectrum events.
|
void |
removeBufferListener(BufferListener listener)
Removes a listener for buffer events.
|
void |
removeMarkerListener(MarkerListener listener)
Removes a listener for marker events.
|
void |
removeMediaErrorListener(MediaErrorListener listener)
Removes a listener for warnings.
|
void |
removeMediaPlayerListener(PlayerStateListener listener)
Removes a listener for media state.
|
void |
removeMediaTimeListener(PlayerTimeListener listener)
Removes a listener for player time events.
|
void |
removeVideoTrackSizeListener(VideoTrackSizeListener listener)
Removes a listener for video track frame dimensions.
|
void |
seek(double streamTime)
Seeks playback to the specified time.
|
protected void |
sendAudioSpectrumEvent(double timestamp,
double duration) |
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 |
sendPlayerEvent(PlayerEvent evt) |
protected void |
sendPlayerHaltEvent(String message,
double time) |
protected void |
sendPlayerMediaErrorEvent(int errorCode) |
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) |
void |
setAudioSyncDelay(long delay)
Set the amount of time to delay the audio.
|
void |
setBalance(float bal)
Sets the balance.
|
void |
setMute(boolean enable)
Enables/disable mute.
|
void |
setRate(float rate)
Sets the rate of playback.
|
void |
setStartTime(double startTime)
Sets the start time within the media to play.
|
void |
setStopTime(double stopTime)
Sets the stop time within the media to stop playback.
|
void |
setVolume(float vol)
Sets the volume.
|
void |
stop()
Stops playing of the media and resets the play time to 0.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetMediaPlayerOverlay@Native public static final int eventPlayerUnknown
@Native public static final int eventPlayerReady
@Native public static final int eventPlayerPlaying
@Native public static final int eventPlayerPaused
@Native public static final int eventPlayerStopped
@Native public static final int eventPlayerStalled
@Native public static final int eventPlayerFinished
@Native public static final int eventPlayerError
@Native public static final long ONE_SECOND
protected NativeMediaPlayer(NativeMedia clip)
clip - Media objectIllegalArgumentException - if
clip is
null.protected void init()
public void addMediaErrorListener(MediaErrorListener listener)
MediaPlayeraddMediaErrorListener in interface MediaPlayerlistener - The warning listener.public void removeMediaErrorListener(MediaErrorListener listener)
MediaPlayerremoveMediaErrorListener in interface MediaPlayerlistener - The warning listener.public void addMediaPlayerListener(PlayerStateListener listener)
MediaPlayeraddMediaPlayerListener in interface MediaPlayerpublic void removeMediaPlayerListener(PlayerStateListener listener)
MediaPlayerremoveMediaPlayerListener in interface MediaPlayerpublic void addMediaTimeListener(PlayerTimeListener listener)
MediaPlayeraddMediaTimeListener in interface MediaPlayerpublic void removeMediaTimeListener(PlayerTimeListener listener)
MediaPlayerremoveMediaTimeListener in interface MediaPlayerpublic void addVideoTrackSizeListener(VideoTrackSizeListener listener)
MediaPlayeraddVideoTrackSizeListener in interface MediaPlayerpublic void removeVideoTrackSizeListener(VideoTrackSizeListener listener)
MediaPlayerremoveVideoTrackSizeListener in interface MediaPlayerpublic void addMarkerListener(MarkerListener listener)
MediaPlayeraddMarkerListener in interface MediaPlayerpublic void removeMarkerListener(MarkerListener listener)
MediaPlayerremoveMarkerListener in interface MediaPlayerpublic void addBufferListener(BufferListener listener)
MediaPlayeraddBufferListener in interface MediaPlayerpublic void removeBufferListener(BufferListener listener)
MediaPlayerremoveBufferListener in interface MediaPlayerpublic void addAudioSpectrumListener(AudioSpectrumListener listener)
MediaPlayeraddAudioSpectrumListener in interface MediaPlayerpublic void removeAudioSpectrumListener(AudioSpectrumListener listener)
MediaPlayerremoveAudioSpectrumListener in interface MediaPlayerpublic VideoRenderControl getVideoRenderControl()
MediaPlayergetVideoRenderControl in interface MediaPlayerVideoRenderControl instance.public Media getMedia()
MediaPlayergetMedia in interface MediaPlayerpublic void setAudioSyncDelay(long delay)
MediaPlayersetAudioSyncDelay in interface MediaPlayerdelay - time in millisecondspublic long getAudioSyncDelay()
MediaPlayergetAudioSyncDelay in interface MediaPlayerpublic void play()
MediaPlayerplay in interface MediaPlayerpublic void stop()
MediaPlayerstop in interface MediaPlayerpublic void pause()
MediaPlayerpause in interface MediaPlayerpublic float getRate()
MediaPlayergetRate in interface MediaPlayerpublic void setRate(float rate)
MediaPlayersetRate in interface MediaPlayerpublic double getPresentationTime()
MediaPlayergetPresentationTime in interface MediaPlayerpublic float getVolume()
MediaPlayergetVolume in interface MediaPlayerpublic void setVolume(float vol)
MediaPlayer[0, 1.0].setVolume in interface MediaPlayervol - A value in the range [0, 1.0].public boolean getMute()
MediaPlayergetMute in interface MediaPlayerpublic void setMute(boolean enable)
setMute in interface MediaPlayerpublic float getBalance()
MediaPlayergetBalance in interface MediaPlayerpublic void setBalance(float bal)
MediaPlayer[-1.0, 1.0].setBalance in interface MediaPlayerbal - A value in the range [-1.0, 1.0].public abstract AudioEqualizer getEqualizer()
MediaPlayergetEqualizer in interface MediaPlayerpublic abstract AudioSpectrum getAudioSpectrum()
MediaPlayergetAudioSpectrum in interface MediaPlayerpublic double getDuration()
MediaPlayergetDuration in interface MediaPlayerpublic double getStartTime()
getStartTime in interface MediaPlayerpublic void setStartTime(double startTime)
setStartTime in interface MediaPlayerpublic double getStopTime()
getStopTime in interface MediaPlayerpublic void setStopTime(double stopTime)
setStopTime in interface MediaPlayerpublic void seek(double streamTime)
MediaPlayerseek in interface MediaPlayerstreamTime - The time in seconds to which to seek.protected abstract long playerGetAudioSyncDelay()
throws MediaException
MediaExceptionprotected abstract void playerSetAudioSyncDelay(long delay)
throws MediaException
MediaExceptionprotected abstract void playerPlay()
throws MediaException
MediaExceptionprotected abstract void playerStop()
throws MediaException
MediaExceptionprotected abstract void playerPause()
throws MediaException
MediaExceptionprotected abstract void playerFinish()
throws MediaException
MediaExceptionprotected abstract float playerGetRate()
throws MediaException
MediaExceptionprotected abstract void playerSetRate(float rate)
throws MediaException
MediaExceptionprotected abstract double playerGetPresentationTime()
throws MediaException
MediaExceptionprotected abstract boolean playerGetMute()
throws MediaException
MediaExceptionprotected abstract void playerSetMute(boolean state)
throws MediaException
MediaExceptionprotected abstract float playerGetVolume()
throws MediaException
MediaExceptionprotected abstract void playerSetVolume(float volume)
throws MediaException
MediaExceptionprotected abstract float playerGetBalance()
throws MediaException
MediaExceptionprotected abstract void playerSetBalance(float balance)
throws MediaException
MediaExceptionprotected abstract double playerGetDuration()
throws MediaException
MediaExceptionprotected abstract void playerSeek(double streamTime)
throws MediaException
MediaExceptionprotected abstract void playerInit()
throws MediaException
MediaExceptionprotected abstract void playerDispose()
public PlayerStateEvent.PlayerState getState()
state of the player.getState in interface MediaPlayerpublic final void dispose()
MediaPlayerdispose in interface MediaPlayerprotected void sendWarning(int warningCode,
String warningMessage)
protected void sendPlayerEvent(PlayerEvent evt)
protected void sendPlayerHaltEvent(String message, double time)
protected void sendPlayerMediaErrorEvent(int errorCode)
protected void sendPlayerStateEvent(int eventID,
double time)
protected void sendNewFrameEvent(long nativeRef)
protected void sendFrameSizeChangedEvent(int width,
int height)
protected void sendAudioTrack(boolean enabled,
long trackID,
String name,
int encoding,
String language,
int numChannels,
int channelMask,
float sampleRate)
protected void sendVideoTrack(boolean enabled,
long trackID,
String name,
int encoding,
int width,
int height,
float frameRate,
boolean hasAlphaChannel)
protected void sendSubtitleTrack(boolean enabled,
long trackID,
String name,
int encoding,
String language)
protected void sendMarkerEvent(String name, double time)
protected void sendDurationUpdateEvent(double duration)
protected void sendBufferProgressEvent(double clipDuration,
long bufferStart,
long bufferStop,
long bufferPosition)
protected void sendAudioSpectrumEvent(double timestamp,
double duration)
public void markerStateChanged(boolean hasMarkers)
markerStateChanged in interface MarkerStateListenerprotected AudioEqualizer createNativeAudioEqualizer(long nativeRef)
protected AudioSpectrum createNativeAudioSpectrum(long nativeRef)
Copyright © 2025. All rights reserved.