public class WZPlayerView extends FrameLayout implements WZPlayerAPI.WZVideoStreamReceiver, WZPlayerAPI.WZAudioStreamReceiver
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 |
---|
WZPlayerView(Context context) |
WZPlayerView(Context context,
AttributeSet attrs) |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
int |
getCurrentState()
Get the current player state
|
WZStatus |
getCurrentStatus()
Get the current player status
|
long |
getCurrentTime()
Get the timecode of the most recent frame displayed by the player
|
long |
getDuration()
Returns the duration of a VOD stream
|
int |
getLogLevel()
Set the logging level of the network messages during playing
|
WZDataMap |
getMetadata()
Returns the stream metadata for an actively playing stream
|
int |
getScaleMode()
Get the view's video scaling mode
|
WZStreamConfig |
getStreamConfig()
Returns detailed configuration information for the stream being played (e.g.
|
WZDataMap |
getStreamStats() |
int |
getVolume()
Get the volume level
|
boolean |
isBuffering()
Indicates if the player is actively buffering media
|
boolean |
isMuted()
Indicates if the player's audio track is muted or not
|
boolean |
isPlaying()
Indicates if the player is actively playing media
|
boolean |
isReadyToPlay()
Indicates if the player is in state where play can be initiated
|
void |
mute(boolean isMuted)
Set the muted state of the player's audio track
|
void |
onAudioSampleReceived(int sampleType,
long timecodeMs,
byte[] sampleBuffer) |
void |
onEnhancedSeekEnd() |
void |
onEnhancedSeekStart() |
void |
onStateChanged(WZStatusCallback statusCallback)
Set the player state change callback
|
void |
onVideoFrameReceived(int frameType,
long timecodeMs,
byte[] frameBuffer) |
void |
play(WZPlayerConfig playerConfig,
WZStatusCallback statusCallback)
Start playback using the specified stream configuration.
|
void |
registerDataEventListener(String eventName,
WZDataEvent.EventListener eventListener)
Register a data event listener to be invoked upon receiving a specified named data event
|
void |
sendDataEvent(WZDataScope eventScope,
String eventName)
Send a data event with the specified scope, name, and parameters
|
void |
sendDataEvent(WZDataScope eventScope,
String eventName,
WZDataEvent.ResultCallback resultCallback)
Send a data event with the specified scope, name, and result callback.
|
void |
sendDataEvent(WZDataScope eventScope,
String eventName,
WZDataMap eventParams)
Send a data event with the specified scope, name, and parameters
|
void |
sendDataEvent(WZDataScope eventScope,
String eventName,
WZDataMap eventParams,
WZDataEvent.ResultCallback resultCallback)
Send a data event with the specified scope, name, parameters, and result callback.
|
void |
sendPingRequest(WZDataEvent.ResultCallback resultCallback)
Sends a ping request to the server and returns the result to the specified callback.
|
void |
setLogLevel(int logLevel)
Returns the logging level of the network messages during playing
|
void |
setScaleMode(int scaleMode)
Set the view's video scaling mode
|
void |
setVolume(int volume)
Set the volume level
|
void |
stop()
Stop playback.
|
void |
stop(WZStatusCallback statusCallback)
Stop playback.
|
void |
unregisterDataEventListener(String eventName,
WZDataEvent.EventListener eventListener)
Unregister a previouslly registered 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 WZPlayerView(Context context)
public WZPlayerView(Context context, AttributeSet attrs)
public void onStateChanged(WZStatusCallback statusCallback)
statusCallback
- the player status callbackpublic int getCurrentState()
public WZStatus getCurrentStatus()
public int getVolume()
public void setVolume(int volume)
volume
- A value between 0 and 100 specifying the volume levelpublic void mute(boolean isMuted)
isMuted
- true to mute, false otherwisepublic boolean isMuted()
public int getScaleMode()
WZMediaConfig.FILL_VIEW
or WZMediaConfig.RESIZE_TO_ASPECT
(default)public void setScaleMode(int scaleMode)
scaleMode
- One of WZMediaConfig.FILL_VIEW
or WZMediaConfig.RESIZE_TO_ASPECT
(default)public void clear()
public int getLogLevel()
WZLog
public void setLogLevel(int logLevel)
logLevel
- One of the log levels defined in WZLog
public boolean isReadyToPlay()
public void play(WZPlayerConfig playerConfig, WZStatusCallback statusCallback)
playerConfig
- the stream configuration to activatepublic void stop()
public void stop(WZStatusCallback statusCallback)
public void onEnhancedSeekStart()
onEnhancedSeekStart
in interface WZPlayerAPI.WZVideoStreamReceiver
public void onEnhancedSeekEnd()
onEnhancedSeekEnd
in interface WZPlayerAPI.WZVideoStreamReceiver
public void onVideoFrameReceived(int frameType, long timecodeMs, byte[] frameBuffer)
onVideoFrameReceived
in interface WZPlayerAPI.WZVideoStreamReceiver
public void onAudioSampleReceived(int sampleType, long timecodeMs, byte[] sampleBuffer)
onAudioSampleReceived
in interface WZPlayerAPI.WZAudioStreamReceiver
public boolean isPlaying()
public boolean isBuffering()
public long getCurrentTime()
public WZStreamConfig getStreamConfig()
public long getDuration()
public WZDataMap getMetadata()
null
if there is not an actively playing streampublic void sendDataEvent(WZDataScope eventScope, String eventName, WZDataMap eventParams, WZDataEvent.ResultCallback resultCallback)
eventScope
- One of WZDataScope.STREAM
or WZDataScope.MODULE
, the scope to which the event applies.
Note that if eventScope
is WZDataScope.STREAM
the resultCallback
parameter must be null
eventName
- The name of the event to sendeventParams
- A name/value pair hash map of the event's parametersresultCallback
- An implementation of the WZDataEvent.ResultCallback
interface
whose WZDataEvent.ResultCallback#onWZDataEventResult
method
will be invoked upon receiving a resulting response from the server.public void sendDataEvent(WZDataScope eventScope, String eventName, WZDataEvent.ResultCallback resultCallback)
eventScope
- One of WZDataScope.STREAM
or WZDataScope.MODULE
, the scope to which the event applies.
Note that if eventScope
is WZDataScope.STREAM
the resultCallback
parameter must be null
eventName
- The name of the event to sendresultCallback
- An implementation of the WZDataEvent.ResultCallback
interface
whose WZDataEvent.ResultCallback#onWZDataEventResult
method
will be invoked upon receiving a resulting response from the server.public void sendDataEvent(WZDataScope eventScope, String eventName, WZDataMap eventParams)
eventScope
- One of WZDataScope.STREAM
or WZDataScope.MODULE
, the scope to which the event applies.eventName
- The name of the event to sendeventParams
- A name/value pair hash map of the event's parameterspublic void sendDataEvent(WZDataScope eventScope, String eventName)
eventScope
- One of WZDataScope.STREAM
or WZDataScope.MODULE
, the scope to which the event applies.eventName
- The name of the eventpublic void registerDataEventListener(String eventName, WZDataEvent.EventListener eventListener)
eventName
- The name of the eventeventListener
- A callback instance to be invoked when the specified event is receivedpublic void unregisterDataEventListener(String eventName, WZDataEvent.EventListener eventListener)
eventName
- The name of the eventeventListener
- A previouslly registered data event listenerpublic WZDataMap getStreamStats()
public void sendPingRequest(WZDataEvent.ResultCallback resultCallback)
responseTime
present in the parameters sent to the resultCallback
resultCallback
- A callback to be invoked with the results of the request. The responseTime
property of the result parameters passed to the callback will contain the response time, in milliseconds.© 2016 Wowza Media Systems, LLC. All rights reserved. Terms | Privacy | Trademarks | Legal