public class WOWZPlayerView extends FrameLayout implements WOWZPlayerAPI.WZVideoStreamReceiver, WOWZPlayerAPI.WZAudioStreamReceiver
Modifier and Type | Class and Description |
---|---|
static interface |
WOWZPlayerView.PacketThresholdChangeListener |
Modifier and Type | Field and Description |
---|---|
static int |
STATE_ERROR |
static int |
STATE_PLAYBACK_COMPLETE |
static int |
STATE_PLAYING |
static int |
STATE_PREBUFFERING_ENDED |
static int |
STATE_PREBUFFERING_STARTED |
static int |
STATE_PREPARING |
static int |
STATE_READY_TO_PLAY |
static int |
STATE_STOPPING |
Constructor and Description |
---|
WOWZPlayerView(Context context) |
WOWZPlayerView(Context context,
AttributeSet attrs) |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
int |
getCurrentState()
Gets the current player state.
|
WOWZStatus |
getCurrentStatus()
Gets the current player status.
|
long |
getCurrentTime()
Gets the timecode of the most recent frame displayed by the player.
|
long |
getDuration()
Gets the duration of a video-on-demand stream.
|
int |
getLogLevel()
Gets the logging level of the network messages during playback.
|
WOWZDataMap |
getMetadata()
Gets metadata for the actively playing stream.
|
int |
getScaleMode()
Gets the view's video scaling mode.
|
WOWZStreamConfig |
getStreamConfig()
Gets detailed configuration information for the most recently played stream.
|
WOWZDataMap |
getStreamStats() |
int |
getVolume()
Gets the volume level.
|
boolean |
isBuffering()
Checks whether the player is actively buffering media.
|
boolean |
isMuted()
Checks whether the player's audio track is muted.
|
boolean |
isPlaying()
Checks whether the player is actively playing media.
|
boolean |
isReadyToPlay()
Checks whether the player is in a state that allows playback to start.
|
void |
mute(boolean isMuted)
Sets the player's audio track to mute.
|
void |
onAudioSampleReceived(int sampleType,
long timecodeMs,
byte[] sampleBuffer) |
void |
onEnhancedSeekEnd() |
void |
onEnhancedSeekStart() |
void |
onStateChanged(WOWZStatusCallback statusCallback)
Sets the player state change callback.
|
void |
onVideoFrameReceived(int frameType,
long timecodeMs,
byte[] frameBuffer,
long timecodeOffset) |
void |
pauseNetworkStack() |
void |
play(WOWZPlayerConfig playerConfig,
WOWZStatusCallback statusCallback)
Starts playback using the specified stream configuration.
|
void |
registerDataEventListener(java.lang.String eventName,
WOWZDataEvent.EventListener eventListener)
Registers a data event listener to be invoked upon receiving a specified event.
|
void |
registerPacketThresholdListener(WOWZPlayerView.PacketThresholdChangeListener changeListener)
Registers a packet notification listener to be invoked upon incoming packet count falling below the specified minimum threshold.
|
void |
sendDataEvent(WOWZDataScope eventScope,
java.lang.String eventName)
Sends a data event with the specified scope, name, and parameters.
|
void |
sendDataEvent(WOWZDataScope eventScope,
java.lang.String eventName,
WOWZDataEvent.ResultCallback resultCallback)
Sends a data event with the specified scope, name, and result callback.
|
void |
sendDataEvent(WOWZDataScope eventScope,
java.lang.String eventName,
WOWZDataMap eventParams)
Sends a data event with the specified scope, name, and parameters.
|
void |
sendDataEvent(WOWZDataScope eventScope,
java.lang.String eventName,
WOWZDataMap eventParams,
WOWZDataEvent.ResultCallback resultCallback)
Sends a data event with the specified scope, name, parameters, and result callback.
|
void |
sendPingRequest(WOWZDataEvent.ResultCallback resultCallback)
Pings the server and returns the result to the specified callback.
|
void |
setLogLevel(int logLevel)
Sets the logging level of the network messages during playback.
|
void |
setMinimumPacketThreshold(int threshold)
You can modify the minimum threshold for when the PacketThresholdChangeListener is invoked.
|
void |
setScaleMode(int scaleMode)
Sets the view's video scaling mode.
|
void |
setShowAllNotificationsWhenBelowThreshold(boolean show)
You can have the system notify you of each packet count when minimum threshold is met.
|
void |
setVolume(int volume)
Sets the volume level.
|
void |
stop()
Stops playback.
|
void |
stop(WOWZStatusCallback statusCallback)
Stops playback.
|
void |
surfaceChanged(SurfaceHolder surfaceHolder,
int format,
int width,
int height)
This is called immediately after any structural changes (format or size) have been made to the surface.
|
void |
surfaceCreated(SurfaceHolder surfaceHolder)
This is called immediately after the surface is first created.
|
void |
surfaceDestroyed(SurfaceHolder surfaceHolder)
This is called immediately before a surface is being destroyed.
|
void |
unpauseNetworkStack() |
void |
unregisterDataEventListener(java.lang.String eventName,
WOWZDataEvent.EventListener eventListener)
Unregisters a data event listener.
|
public static final int STATE_READY_TO_PLAY
public static final int STATE_PREPARING
public static final int STATE_PLAYING
public static final int STATE_STOPPING
public static final int STATE_PLAYBACK_COMPLETE
public static final int STATE_ERROR
public static final int STATE_PREBUFFERING_STARTED
public static final int STATE_PREBUFFERING_ENDED
public WOWZPlayerView(Context context)
public WOWZPlayerView(Context context, AttributeSet attrs)
public void surfaceCreated(SurfaceHolder surfaceHolder)
surfaceHolder
- SurfaceHolder: The SurfaceHolder whose surface is being created.public void surfaceChanged(SurfaceHolder surfaceHolder, int format, int width, int height)
surfaceHolder
- SurfaceHolder: The SurfaceHolder whose surface has changed.format
- int: The new PixelFormat of the surface.width
- int: The new width of the surface.height
- int: The new height of the surface.public void surfaceDestroyed(SurfaceHolder surfaceHolder)
surfaceHolder
- SurfaceHolder: The SurfaceHolder whose surface is being destroyed.public void pauseNetworkStack()
public void unpauseNetworkStack()
public void onStateChanged(WOWZStatusCallback statusCallback)
statusCallback
- The player status callback.public int getCurrentState()
public WOWZStatus getCurrentStatus()
public int getVolume()
public void setVolume(int volume)
volume
- A value between 0 and 100 that specifies the volume level.public void mute(boolean isMuted)
isMuted
- True to mute; false otherwise.public boolean isMuted()
public int getScaleMode()
WOWZMediaConfig.FILL_VIEW
or WOWZMediaConfig.RESIZE_TO_ASPECT
(default).public void setScaleMode(int scaleMode)
scaleMode
- One of WOWZMediaConfig.FILL_VIEW
or WOWZMediaConfig.RESIZE_TO_ASPECT
(default).public void clear()
public int getLogLevel()
WOWZLog
.public void setLogLevel(int logLevel)
logLevel
- One of the log levels defined in WOWZLog
.public boolean isReadyToPlay()
public void play(WOWZPlayerConfig playerConfig, WOWZStatusCallback statusCallback)
playerConfig
- The stream configuration to use.public void stop()
public void stop(WOWZStatusCallback statusCallback)
public void onEnhancedSeekStart()
onEnhancedSeekStart
in interface WOWZPlayerAPI.WZVideoStreamReceiver
public void onEnhancedSeekEnd()
onEnhancedSeekEnd
in interface WOWZPlayerAPI.WZVideoStreamReceiver
public void onVideoFrameReceived(int frameType, long timecodeMs, byte[] frameBuffer, long timecodeOffset)
onVideoFrameReceived
in interface WOWZPlayerAPI.WZVideoStreamReceiver
public void onAudioSampleReceived(int sampleType, long timecodeMs, byte[] sampleBuffer)
onAudioSampleReceived
in interface WOWZPlayerAPI.WZAudioStreamReceiver
public boolean isPlaying()
public boolean isBuffering()
public long getCurrentTime()
public WOWZStreamConfig getStreamConfig()
public long getDuration()
public WOWZDataMap getMetadata()
public void sendDataEvent(WOWZDataScope eventScope, java.lang.String eventName, WOWZDataMap eventParams, WOWZDataEvent.ResultCallback resultCallback)
eventScope
- One of WOWZDataScope.STREAM
or WOWZDataScope.MODULE
, the scope to which the event applies.
If eventScope is WOWZDataScope#STREAM, the resultCallback parameter must be null.eventName
- The name of the event to send.eventParams
- A name/value pair hash map of the event's parameters.resultCallback
- An implementation of the WOWZDataEvent.ResultCallback
interface
whose WOWZDataEvent.ResultCallback#onWZDataEventResult
method
will be invoked upon receiving a resulting response from the server.public void sendDataEvent(WOWZDataScope eventScope, java.lang.String eventName, WOWZDataEvent.ResultCallback resultCallback)
eventScope
- One of WOWZDataScope.STREAM
or WOWZDataScope.MODULE
, the scope to which the event applies.
If eventScope is WOWZDataScope#STREAM, the resultCallback parameter must be null.eventName
- The name of the event to send.resultCallback
- An implementation of the WOWZDataEvent.ResultCallback
interface
whose WOWZDataEvent.ResultCallback#onWZDataEventResult
method
will be invoked upon receiving a resulting response from the server.public void sendDataEvent(WOWZDataScope eventScope, java.lang.String eventName, WOWZDataMap eventParams)
eventScope
- One of WOWZDataScope.STREAM
or WOWZDataScope.MODULE
, the scope to which the event applies.eventName
- The name of the event to send.eventParams
- A name/value pair hash map of the event's parameters.public void sendDataEvent(WOWZDataScope eventScope, java.lang.String eventName)
eventScope
- One of WOWZDataScope.STREAM
or WOWZDataScope.MODULE
, the scope to which the event applies.eventName
- The name of the event.public void registerDataEventListener(java.lang.String eventName, WOWZDataEvent.EventListener eventListener)
eventName
- The name of the event.eventListener
- A callback instance to be invoked when the event is received.public void setShowAllNotificationsWhenBelowThreshold(boolean show)
show
- all packet counts while below minimum threshold.public void setMinimumPacketThreshold(int threshold)
threshold
- Minimum threshold prior to notification.public void registerPacketThresholdListener(WOWZPlayerView.PacketThresholdChangeListener changeListener)
changeListener
- The listener to be invoked upon said event occurring.public void unregisterDataEventListener(java.lang.String eventName, WOWZDataEvent.EventListener eventListener)
eventName
- The name of the event.eventListener
- A previously registered data event listener.public WOWZDataMap getStreamStats()
public void sendPingRequest(WOWZDataEvent.ResultCallback resultCallback)
resultCallback
- A callback to be invoked with the results of the request. The responseTime property of the result parameters passed to the callback contain the response time, in milliseconds.© 2016 - 2019 Wowza Media Systems, LLC. All rights reserved. Terms | Privacy | Trademarks | Legal