public interface IClient
IClient: public interface to Client object.
| Modifier and Type | Field | Description |
|---|---|---|
static String |
AUDIOSAMPLE_ACCESS_ALL |
|
static String |
AUDIOSAMPLE_ACCESS_NONE |
|
static String |
READ_ACCESS_ALL |
|
static String |
READ_ACCESS_NONE |
|
static String |
VIDEOSAMPLE_ACCESS_ALL |
|
static String |
VIDEOSAMPLE_ACCESS_NONE |
|
static String |
WRITE_ACCESS_ALL |
|
static String |
WRITE_ACCESS_NONE |
| Modifier and Type | Method | Description |
|---|---|---|
void |
acceptConnection() |
Accept connection
|
void |
acceptConnection(AMFData successObj) |
Accept connection
|
void |
acceptConnection(String successStr) |
Accept connection
|
void |
addAcceptConnectionAttribute(String key,
AMFDataObj item) |
Add and attribute to the resultObj that gets passed back to the client on successful connection
|
void |
addAcceptConnectionAttribute(String key,
String item) |
Add and attribute to the resultObj that gets passed back to the client on successful connection
|
void |
call(String handlerName) |
Simplified call client method/handler call.
|
void |
call(String handlerName,
IModuleCallResult resultObj,
Object... params) |
Call client method/handler.
|
void |
clearFastPlaySettings() |
Force clear the fastPlay settings
|
void |
fcSubscribe(String streamName) |
Subscribe to a live stream (for live stream repeater to start start from edge to origin)
|
void |
fcSubscribe(String streamName,
String mediaCasterType) |
Subscribe to a live stream (use a particular mediaCasterType)
|
void |
fcUnSubscribe(String streamName) |
UnSubscribe from a stream
|
void |
fcUnSubscribeAll() |
UnSubscribe to all streams that this client is current subscribed to
|
IApplicationInstance |
getAppInstance() |
Get parent applicationInstance.
|
IApplication |
getApplication() |
Get parent application.
|
int |
getBufferTime() |
Get default buffer time for newly created mediaStream objects
|
int |
getClientId() |
Get client id.
|
long |
getConnectTime() |
Get time in milliseconds the client connected to the server.
|
String |
getDateStarted() |
Get date and time of client connection
|
ElapsedTimer |
getElapsedTime() |
Get elapsed time client has been connected.
|
com.wowza.wms.stream.FastPlaySettings |
getFastPlaySettings() |
Get the current fastPlay settings.
|
String |
getFlashVer() |
Get client flash version
|
String |
getForwardedIP() |
Get the forwarded IP of the connected client, if available.
|
int |
getIdleFrequency() |
Get client idle frequency (milliseconds)
|
String |
getIp() |
Client ip address
|
long |
getLastValidateTime() |
Get last time (millisecond) the connection was validated with a ping
|
int |
getLiveRepeaterCapabilities() |
Get the live repeater capabilities of this connection
|
String |
getLiveStreamPacketizerList() |
Get the comma separated list of LiveStreamPacketizers names being used by this client (see conf/LiveStreamPacketizers.xml)
|
String |
getLiveStreamTranscoderList() |
Get the comma separated list of LiveStreamTranscoders names being used by this client (see conf/LiveStreamTranscoders.xml)
|
int |
getMaximumPendingWriteBytes() |
Get maximum number a bytes a client connection can have waiting to be sent before the connection is terminated.
|
int |
getMaximumSetBufferTime() |
Get maximum number of milliseconds allowed for the NetStream.setBufferTime(secs) call.
|
IOPerformanceCounter |
getMediaIOPerformanceCounter() |
Get performance counter for media bytes transferred to this client.
|
int |
getObjectEncoding() |
Get the object encoding level
|
String |
getPageUrl() |
Get the pageUrl for this connection.
|
long |
getPingRoundTripTime() |
Get turn around time (milliseconds) of last ping request
|
int |
getPingTimeout() |
Get the ping timeout (milliseconds)
|
int |
getPlayStreamCount() |
Get the number of play streams
|
java.util.List |
getPlayStreams() |
Get a collection of all play streams.
|
WMSProperties |
getProperties() |
Get client properties
|
int |
getProtocol() |
Get connection protocol (1 = RTMP, 3 = RTMPT)
|
int |
getPublishStreamCount() |
Get the number of publish streams
|
java.util.List |
getPublishStreams() |
Get a collection of publish streams.
|
String |
getQueryStr() |
Get the query string part of the connection string.
|
String |
getReferrer() |
Get the referrer data for this connection.
|
String |
getRepeaterOriginUrl() |
Get the origin URL used by the Live Stream Repeater
|
AMFObj |
getRespAMFAudioObj(IMediaStream stream) |
Get the audio response AMFObj for a given mediaStream
|
AMFObj |
getRespAMFDataObj(IMediaStream stream) |
Get the data response AMFObj for a given mediaStream
|
AMFObj |
getRespAMFVideoObj(IMediaStream stream) |
Get the video response AMFObj for a given mediaStream
|
ResponseFunctions |
getRespFunctions() |
Get client responseFunctions object.
|
AMFObj |
getResponseAMFObj(int index) |
Get the response channel AMFObj for channel index.
|
RTPStream |
getRTPStream() |
If this client was created due to an RTP connection to the server return the underlying RTPStream object
|
HostPort |
getServerHostPort() |
Get the hostPort object for the connection that is servicing this client
|
String |
getSharedObjectReadAccess() |
Get the shared object read access value.
|
String |
getSharedObjectWriteAccess() |
Get the shared object write access value.
|
String |
getStreamAudioSampleAccess() |
Get the audio sample access value.
|
java.io.File |
getStreamFile(String streamName) |
Get File object for stream with given name.
|
java.io.File |
getStreamFile(String streamName,
String streamExt) |
Get File object for stream with given name and extension.
|
java.io.File |
getStreamFile(String streamName,
String streamExt,
boolean doCreateFolder) |
Get File object for stream with given name and extension.
|
String |
getStreamReadAccess() |
Get the stream read access value.
|
String |
getStreamType() |
Get default streamType
|
String |
getStreamVideoSampleAccess() |
Get the video sample access value.
|
String |
getStreamWriteAccess() |
Get the stream write access value.
|
String |
getTimeRunning() |
Get elapsed time of connection
|
double |
getTimeRunningSeconds() |
Get time running in seconds
|
IOPerformanceCounter |
getTotalIOPerformanceCounter() |
Get performance counter for all bytes transferred to this client.
|
String |
getUri() |
Get the full URI of the connection string
|
IVHost |
getVHost() |
Get parent vHost
|
com.wowza.wms.protocol.wowz.WOWZSession |
getWowzSession() |
|
com.wowza.wms.client.ClientWriteListener |
getWriteListener() |
Object that tracks write operations
|
boolean |
isAcceptConnection() |
Is auto accept connection
|
boolean |
isAcceptConnectionSendClientId() |
Include the client id in the accept connection response
|
boolean |
isConnected() |
Is this client connected
|
boolean |
isEncrypted() |
Is this connection encrypted (RTMPE or RTMPTE)
|
boolean |
isFlashMediaLiveEncoder() |
Returns true if this connection is the Flash Media Live Encoder
|
boolean |
isFlashVersion10() |
Returns true if the Flash version is equal or greater than 10.x.x.x
|
boolean |
isFlashVersion90115() |
Returns true if the Flash version is equal or greater than 9.0.115.x
|
boolean |
isFlashVersionH264Capable() |
Returns true if the connected client is capable of playing H.264 video (Flash player 9.0.45.x or greater)
|
boolean |
isLiveRepeater() |
Returns true if this connection is from the live stream repeater
|
boolean |
isObjectEncodingAMF0() |
Is the object encoding for this client AMF0
|
boolean |
isObjectEncodingAMF3() |
Is the object encoding for this client AMF3
|
boolean |
isSecure() |
Is this connection protected by either SSL or encryption (RTMPE, RTMPTE, RTMPS)
|
boolean |
isSendCloseOnRejectConnection() |
|
boolean |
isSSL() |
Is this connection SSL (RTMPS)
|
boolean |
isValidateFMLEConnections() |
Returns true if validating FMLE connection (default is false)
|
int |
ping(IModulePingResult pingResult) |
Ping client.
|
void |
redirectConnection(String url) |
Redirection connection (NetConnection.onStatus handler returns info.code of NetConnection.Connect.Rejected and info.ex.code of 302)
|
void |
redirectConnection(String url,
String description) |
Redirection connection (NetConnection.onStatus handler returns info.code of NetConnection.Connect.Rejected and info.ex.code of 302)
|
void |
redirectConnection(String url,
String description,
AMFData errorObj) |
Redirection connection (NetConnection.onStatus handler returns info.code of NetConnection.Connect.Rejected and info.ex.code of 302).
|
void |
redirectConnection(String url,
String description,
String errorStr) |
Redirection connection (NetConnection.onStatus handler returns info.code of NetConnection.Connect.Rejected and info.ex.code of 302)
|
void |
rejectConnection() |
Reject connection (NetConnection.onStatus handler returns info.code of NetConnection.Connect.Rejected)
|
void |
rejectConnection(AMFData errorObj) |
Reject connection (NetConnection.onStatus handler returns info.code of NetConnection.Connect.Rejected)
|
void |
rejectConnection(String errorStr) |
Reject connection (NetConnection.onStatus handler returns info.code of NetConnection.Connect.Rejected)
|
void |
rejectConnection(String description,
AMFData errorObj) |
Reject connection (NetConnection.onStatus handler returns info.code of NetConnection.Connect.Rejected)
|
void |
rejectConnection(String description,
String errorStr) |
Reject connection (NetConnection.onStatus handler returns info.code of NetConnection.Connect.Rejected)
|
void |
reparentClient(IVHost vhost) |
Move a client object to a new vhost.
|
void |
setAcceptConnection(boolean acceptConnection) |
Set the default for accept connection
|
void |
setAcceptConnectionDescription(String description) |
Call this method from onConnect to set the info.description property returned in NetConnection onStatus handler
|
void |
setAcceptConnectionExObj(AMFDataObj acceptConnectionExObj) |
Call this method from onConnect to set the info.ex property returned in NetConnection onStatus handler
|
void |
setAcceptConnectionObj(AMFData acceptConnectionObj) |
Call this method from onConnect to add an "application" property to the info object that is passed back to the
Flash client in the onStatus handler.
|
void |
setAcceptConnectionSendClientId(boolean acceptConnectionSendClientId) |
Include the client id in the connection response
|
void |
setBufferTime(int bufferTime) |
Set default buffer time for newly created mediaStream objects
|
void |
setFastPlaySettings(com.wowza.wms.stream.FastPlaySettings fastPlaySettings) |
Set fastPlay settings
|
void |
setFlashVer(String flashVer) |
Set client flash version
|
void |
setForwardedIP(String IP) |
Set the forwarded IP of the connected client.
|
void |
setIdleFrequency(int idleFrequency) |
Set client idle frequency (milliseconds)
|
void |
setLastValidateTime(long lastValidateTime) |
Set the last time (milliseconds) the connection was validated with ping
|
void |
setLiveRepeaterCapabilities(int liveRepeaterCapabilities) |
Set the live repeater capabilities of this connection
|
void |
setLiveStreamPacketizerList(String liveStreamPacketizerList) |
Set the comma separated list of LiveStreamPacketizers names being used by this client (see conf/LiveStreamPacketizers.xml)
|
void |
setLiveStreamTranscoderList(String liveStreamTranscoderList) |
Set the comma separated list of LiveStreamTranscoders names being used by this client (see conf/LiveStreamTranscoders.xml)
|
void |
setObjectEncoding(int objectEncoding) |
Set the object encoding level
|
void |
setRepeaterOriginUrl(String repeaterOriginUrl) |
Set the origin URL used by the Live Stream Repeater
|
void |
setSendCloseOnRejectConnection(boolean sendCloseOnRejectConnection) |
|
void |
setSharedObjectReadAccess(String sharedObjectReadAccess) |
Set the shared object read access value.
|
void |
setSharedObjectWriteAccess(String sharedObjectWriteAccess) |
Set the shared object write access value.
|
void |
setShutdownClient(boolean shutdownClient) |
Gracefully and forcefully shutdown a client.
|
void |
setStreamAudioSampleAccess(String audioSampleAccess) |
Set the stream audio sample access value.
|
void |
setStreamReadAccess(String streamReadAccess) |
Set the stream object read access value.
|
void |
setStreamType(String streamType) |
Set default streamType
|
void |
setStreamVideoSampleAccess(String videoSampleAccess) |
Set the stream video sample access value.
|
void |
setStreamWriteAccess(String streamWriteAccess) |
Set the stream object write access value.
|
void |
setThreadContext() |
Set the thread logging context to this client
|
void |
setValidateFMLEConnections(boolean validateFMLEConnections) |
Returns true if validating FMLE connection (default is false)
|
void |
setWowzSession(com.wowza.wms.protocol.wowz.WOWZSession wowzSession) |
|
void |
shutdownClient() |
Gracefully shutdown a client.
|
int |
testFlashVersion(int[] version) |
Test to see if the connected client flash version is equal to or greater than a given value.
|
void |
touch() |
Update the last touch time for client
|
static final String AUDIOSAMPLE_ACCESS_ALL
static final String AUDIOSAMPLE_ACCESS_NONE
static final String READ_ACCESS_ALL
static final String READ_ACCESS_NONE
static final String VIDEOSAMPLE_ACCESS_ALL
static final String VIDEOSAMPLE_ACCESS_NONE
static final String WRITE_ACCESS_ALL
static final String WRITE_ACCESS_NONE
void acceptConnection()
void acceptConnection(AMFData successObj)
successObj - application property value added to NetConnection.Connect.Success event objectvoid acceptConnection(String successStr)
successStr - application property value added to NetConnection.Connect.Success event objectvoid addAcceptConnectionAttribute(String key,
AMFDataObj item)
key - keyitem - item to addvoid addAcceptConnectionAttribute(String key,
String item)
key - keyitem - item to addvoid call(String handlerName)
handlerName - handler namevoid call(String handlerName,
IModuleCallResult resultObj,
Object... params)
IClient client;
class ReturnObj implements IModuleCallResult
{
public void onResult(IClient client, RequestFunction function,
AMFDataList params)
{
WMSLoggerFactory.getLogger(null).debug("onResult");
}
}
client.call("onCustomMethod", new ReturnObj(), "param1", 1.2345, false, new Date());
handlerName - handler nameresultObj - if client method returns data this object will receive callback, null if don't care or no return on client method/handler.params - variable list of argument. Will be automatically wrapped in AMFData objectsvoid clearFastPlaySettings()
void fcSubscribe(String streamName)
streamName - stream namevoid fcSubscribe(String streamName,
String mediaCasterType)
streamName - stream namemediaCasterType - media caster type namevoid fcUnSubscribe(String streamName)
streamName - stream namevoid fcUnSubscribeAll()
IApplicationInstance getAppInstance()
IApplication getApplication()
int getBufferTime()
int getClientId()
long getConnectTime()
String getDateStarted()
ElapsedTimer getElapsedTime()
com.wowza.wms.stream.FastPlaySettings getFastPlaySettings()
String getFlashVer()
String getForwardedIP()
int getIdleFrequency()
String getIp()
long getLastValidateTime()
int getLiveRepeaterCapabilities()
String getLiveStreamPacketizerList()
String getLiveStreamTranscoderList()
int getMaximumPendingWriteBytes()
int getMaximumSetBufferTime()
IOPerformanceCounter getMediaIOPerformanceCounter()
int getObjectEncoding()
String getPageUrl()
long getPingRoundTripTime()
int getPingTimeout()
int getPlayStreamCount()
java.util.List getPlayStreams()
IClient client;
List playStreams = client.getPlayStreams();
Iterator iter = playStreams.iterator();
while(iter.hasNext())
{
IMediaStream stream = (IMediaStream)iter.next();
WMSLoggerFactory.getLogger(null).debug("stream: "+stream.getName());
}
WMSProperties getProperties()
int getProtocol()
int getPublishStreamCount()
java.util.List getPublishStreams()
IClient client;
List publishStreams = client.getPublishStreams();
Iterator iter = publishStreams.iterator();
while(iter.hasNext())
{
IMediaStream stream = (IMediaStream)iter.next();
WMSLoggerFactory.getLogger(null).debug("stream: "+stream.getName());
}
String getQueryStr()
rtmp://localhost/app/appInst?data1=myData1&data2=myData2, then query string would be data1=myData1&data2=myData2String getReferrer()
public class MyModule extends ModuleBase
{
static public void onConnect(IClient client, RequestFunction function,
AMFDataList params)
{
String referrer = client.getReferrer();
if (referrer.indexOf("www.mycompany.com") >= 0 &&
referrer.indexOf("mycoolflash.swf") >= 0)
client.acceptConnection("valid referrer");
else
client.rejectConnection("invalid referrer: "+referrer);
}
}
String getRepeaterOriginUrl()
AMFObj getRespAMFAudioObj(IMediaStream stream)
stream - mediaStreamAMFObj getRespAMFDataObj(IMediaStream stream)
stream - mediaStreamAMFObj getRespAMFVideoObj(IMediaStream stream)
stream - mediaStreamResponseFunctions getRespFunctions()
ResponseFunctions respFunctions = client.getRespFunctions();
ResponseFunction resp = new ResponseFunction();
resp.createDefaultMessage("onStatus", 0.0);
resp.setRetAMFObj(stream.getRespAMFDataObj());
resp.setSrc(stream.getSrc());
AMFDataObj data = new AMFDataObj();
data.put("level", new AMFDataItem("status"));
data.put("code", new AMFDataItem("NetStream.Publish.Success"));
data.put("description", new AMFDataItem(stream.getName()+" is now unpublished."));
data.put("clientid", new AMFDataItem(clientID));
resp.addBody(data);
respFunctions.add(resp);
AMFObj getResponseAMFObj(int index)
index - channel indexRTPStream getRTPStream()
HostPort getServerHostPort()
String getSharedObjectReadAccess()
String getSharedObjectWriteAccess()
String getStreamAudioSampleAccess()
java.io.File getStreamFile(String streamName)
streamName - stream namejava.io.File getStreamFile(String streamName,
String streamExt)
IClient client;
File file = client.getStreamFile("test", "flv");
WMSLogger log = WMSLoggerFactory.getLogger(null);
if (file != null)
{
if (file.exists())
log.debug("getStreamFile: "+ file.getPath());
}
streamName - stream namestreamExt - stream extensionjava.io.File getStreamFile(String streamName,
String streamExt,
boolean doCreateFolder)
streamName - stream namestreamExt - stream extensiondoCreateFolder - create folders if neededString getStreamReadAccess()
String getStreamType()
String getStreamVideoSampleAccess()
String getStreamWriteAccess()
String getTimeRunning()
double getTimeRunningSeconds()
IOPerformanceCounter getTotalIOPerformanceCounter()
String getUri()
IVHost getVHost()
com.wowza.wms.protocol.wowz.WOWZSession getWowzSession()
com.wowza.wms.client.ClientWriteListener getWriteListener()
boolean isAcceptConnection()
boolean isAcceptConnectionSendClientId()
boolean isConnected()
boolean isEncrypted()
boolean isFlashMediaLiveEncoder()
boolean isFlashVersion10()
boolean isFlashVersion90115()
boolean isFlashVersionH264Capable()
boolean isLiveRepeater()
boolean isObjectEncodingAMF0()
boolean isObjectEncodingAMF3()
boolean isSecure()
boolean isSendCloseOnRejectConnection()
boolean isSSL()
boolean isValidateFMLEConnections()
int ping(IModulePingResult pingResult)
class PingResult implements IModulePingResult
{
public void onResult(IClient client, long pingTime, int pingId, boolean result)
{
WMSLogger log = WMSLoggerFactory.getLogger(null);
log.debug("onResult: result:"+result);
if (!result)
{
// client has died lets kill it
client.getAppInstance().shutdownClient(client);
}
else
log.debug("lastPingTime: "+client.getPingRoundTripTime());
}
}
client.ping(new PingResult());
pingResult - ping result object. Will receive callback on result of ping or timeout. Can be null.void redirectConnection(String url)
url - url (returned in onStatus handler in info.ex.redirect parameter)void redirectConnection(String url,
String description)
url - url (returned in onStatus handler in info.ex.redirect parameter)description - description (returned in onStatus handler in info.description parameter)void redirectConnection(String url,
String description,
AMFData errorObj)
public function ncOnStatus(infoObject:NetStatusEvent)
{
if (infoObject.info.code == "NetConnection.Connect.Rejected")
{
if (infoObject.info.ex.code == 302)
{
trace("Connection redirected: "+infoObject.info.ex.redirect);
nc.connect(infoObject.info.ex.redirect);
}
else
trace("Connection rejected");
}
}
nc.addEventListener(NetStatusEvent.NET_STATUS, ncOnStatus);
url - url (returned in onStatus handler in info.ex.redirect parameter)description - description (returned in onStatus handler in info.description parameter)errorObj - error AMFData (returned in onStatus handler in info.application parameter)void redirectConnection(String url,
String description,
String errorStr)
url - url (returned in onStatus handler in info.ex.redirect parameter)description - description (returned in onStatus handler in info.description parameter)errorStr - error (returned in onStatus handler in info.application parameter)void rejectConnection()
void rejectConnection(AMFData errorObj)
errorObj - error AMFData (returned in onStatus handler in info.application parameter)void rejectConnection(String errorStr)
errorStr - error (returned in onStatus handler in info.application parameter)void rejectConnection(String description,
AMFData errorObj)
description - description (returned in onStatus handler in info.description parameter)errorObj - error AMFData (returned in onStatus handler in info.application parameter)void rejectConnection(String description,
String errorStr)
description - description (returned in onStatus handler in info.description parameter)errorStr - error (returned in onStatus handler in info.application parameter)void reparentClient(IVHost vhost)
vhost - new vhostvoid setAcceptConnection(boolean acceptConnection)
acceptConnection - default for accept connectionvoid setAcceptConnectionDescription(String description)
description - descriptionvoid setAcceptConnectionExObj(AMFDataObj acceptConnectionExObj)
acceptConnectionExObj - exObj AMFData item return in info.ex propert of NetConnection onStatus handlervoid setAcceptConnectionObj(AMFData acceptConnectionObj)
acceptConnectionObj - connection objectvoid setAcceptConnectionSendClientId(boolean acceptConnectionSendClientId)
acceptConnectionSendClientId - true if client id is includedvoid setBufferTime(int bufferTime)
bufferTime - bufer time (milliseconds)void setFastPlaySettings(com.wowza.wms.stream.FastPlaySettings fastPlaySettings)
fastPlaySettings - fastPlay settingsvoid setFlashVer(String flashVer)
flashVer - client flash version stringvoid setForwardedIP(String IP)
IP - void setIdleFrequency(int idleFrequency)
idleFrequency - client idle frequency (milliseconds)void setLastValidateTime(long lastValidateTime)
lastValidateTime - last time (milliseconds) the connection was validated with pingvoid setLiveRepeaterCapabilities(int liveRepeaterCapabilities)
liveRepeaterCapabilities - live repeater capabilities of this connectionvoid setLiveStreamPacketizerList(String liveStreamPacketizerList)
liveStreamPacketizerList - comma separated list of LiveStreamPacketizers namesvoid setLiveStreamTranscoderList(String liveStreamTranscoderList)
liveStreamTranscoderList - comma separated list of LiveStreamTranscoders namesvoid setObjectEncoding(int objectEncoding)
objectEncoding - object encoding levelvoid setRepeaterOriginUrl(String repeaterOriginUrl)
repeaterOriginUrl - URL used by the Live Stream Repeatervoid setSendCloseOnRejectConnection(boolean sendCloseOnRejectConnection)
void setSharedObjectReadAccess(String sharedObjectReadAccess)
sharedObjectReadAccess - shared object read access valuevoid setSharedObjectWriteAccess(String sharedObjectWriteAccess)
sharedObjectWriteAccess - void setShutdownClient(boolean shutdownClient)
shutdownClient - set to true to gracefully and forcefully shutdown a clientvoid setStreamAudioSampleAccess(String audioSampleAccess)
audioSampleAccess - void setStreamReadAccess(String streamReadAccess)
streamReadAccess - shared object read access valuevoid setStreamType(String streamType)
streamType - streamTypevoid setStreamVideoSampleAccess(String videoSampleAccess)
videoSampleAccess - void setStreamWriteAccess(String streamWriteAccess)
streamWriteAccess - shared object read access valuevoid setThreadContext()
void setValidateFMLEConnections(boolean validateFMLEConnections)
validateFMLEConnections - true if validating FMLE connectionvoid setWowzSession(com.wowza.wms.protocol.wowz.WOWZSession wowzSession)
void shutdownClient()
int testFlashVersion(int[] version)
version - array of version valuesvoid touch()