public class ModuleBase
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static int |
PARAM1
In case of
play(IClient, RequestFunction, AMFDataList) and publish(IClient, RequestFunction, AMFDataList) this parameter carries the stream name. |
static int |
PARAM2 |
static int |
PARAM3 |
static int |
PARAMMETHODNAME |
| Constructor and Description |
|---|
ModuleBase() |
| Modifier and Type | Method and Description |
|---|---|
protected static java.lang.String |
getParamString(AMFDataList paramAMFDataList,
int paramInt)
This is method can be used to extract data from the
AMFDataList objects that you get in play/connect/publish methods. |
protected static void |
invokePrevious(java.lang.Object paramObject,
IClient paramIClient,
RequestFunction paramRequestFunction,
AMFDataList paramAMFDataList)
This method passes the control to the next module in the chain of configured modules, allowing each one to act on the lifecycle event.
|
void |
onAppStart(IApplicationInstance appInstance)
This method is invoked by Wowza when your application starts up.
|
void |
onAppStop(IApplicationInstance appInstance)
This method is invoked by Wowza when your application stops.
|
void |
onDisconnect(IClient client)
This method is invoked immediately when an RTMP based player (Flash client) closes, e.g. you close the browser tab with the player on it.
|
void |
onHTTPMPEGDashStreamingSessionCreate(HTTPStreamerSessionMPEGDash client)
This method is invoked every time a new MPEG-DASH sessinon is created.
|
void |
onHTTPMPEGDashStreamingSessionDestroy(HTTPStreamerSessionMPEGDash client)
This method is called when an MPEG-DASH session is destroyed after the client has disconnected
|
void |
onHTTPSanJoseStreamingSessionCreate(HTTPStreamerSessionSanJose client)
This method is invoked every time a new San Jose session is created.
|
void |
onHTTPSanJoseStreamingSessionDestroy(HTTPStreamerSessionSanJose client)
This method is invoked every time a San Jose session is destroyed.
|
void |
onHTTPSessionDestroy(IHTTPStreamerSession httpSession)
This method is invoked whenever a HTTP session is destroyed.
|
void |
onHTTPStreamerRequest(IHTTPStreamerSession httpSession,
IHTTPStreamerRequestContext reqContext)
This method is invoked upon every HTTP request that comes in.
|
void |
onRTPSessionCreate(RTPSession client)
This method is invoked when a new RTP session is created.
|
void |
onRTPSessionDestroy(RTPSession client)
This method is invoked every time an RTP session is destroyed, e.g. your typical IP webcam stops the stream.
|
void |
onStreamCreate(IMediaStream stream)
This is called upon stream creation.
|
void |
onStreamDestroy(IMediaStream stream)
This is called upon stream destruction.
|
void |
play(IClient client,
RequestFunction function,
AMFDataList params)
This method is invoked when an RTMP client starts playing a stream.
|
void |
publish(IClient client,
RequestFunction function,
AMFDataList params)
This method is called whenever a new stream is published by an RTMP publiser, e.g.
|
public static final int PARAMMETHODNAME
public static final int PARAM1
play(IClient, RequestFunction, AMFDataList) and publish(IClient, RequestFunction, AMFDataList) this parameter carries the stream name.public static final int PARAM2
public static final int PARAM3
public void onAppStart(IApplicationInstance appInstance)
appInstance - a class containing information about the particular application instance that is being started along with any configurationpublic void onAppStop(IApplicationInstance appInstance)
appInstance - the application instance that is being stoppedpublic void onRTPSessionCreate(RTPSession client)
client - an object representing the known details about the client that is connectingpublic void onHTTPStreamerRequest(IHTTPStreamerSession httpSession, IHTTPStreamerRequestContext reqContext)
IHTTPStreamerRequestContext.getRequestType() method that you can call and check what happened exactly.httpSession - an object representing the known details about the sessionreqContext - a context object representing some other details about the callpublic void onHTTPSanJoseStreamingSessionCreate(HTTPStreamerSessionSanJose client)
client - an object represeting the session with detailspublic void onHTTPMPEGDashStreamingSessionCreate(HTTPStreamerSessionMPEGDash client)
client - an object represeting the session with detailspublic void onHTTPSessionDestroy(IHTTPStreamerSession httpSession)
httpSession - an object represeting the HTTP session that is being destroyedpublic void onDisconnect(IClient client)
client - the object represeting the previously connected player with all known detailspublic void onRTPSessionDestroy(RTPSession client)
client - the object represeting the session details that is being destroyedpublic void onHTTPSanJoseStreamingSessionDestroy(HTTPStreamerSessionSanJose client)
client - the object represeting the session details that is being destroyedpublic void publish(IClient client, RequestFunction function, AMFDataList params)
String streamName = params.getString(PARAM1); where PARAM1 is a magic number in ModuleBase.client - the object representing the connecting encoderfunction - not sure..params - a data object passed by the encoder, this can be used to find out the stream namepublic void onStreamCreate(IMediaStream stream)
stream.getName() will return null!
It is the point where you can add your @link com.wowza.wms.stream.IMediaStreamActionNotify instance on the stream by calling
IMediaStream.addClientListener(com.wowza.wms.stream.IMediaStreamActionNotify)stream - the stream objectpublic void onStreamDestroy(IMediaStream stream)
IMediaStreamActionNotify instance,
however it is not clear why it is necessary. If the stream object is not reused,
the listener should be garbage collected anyways..stream - the stream objectpublic void onHTTPMPEGDashStreamingSessionDestroy(HTTPStreamerSessionMPEGDash client)
client - the session objectpublic void play(IClient client, RequestFunction function, AMFDataList params)
String streamName = getParamString(params, PARAM1);
Caution: despite the name, it is not invoked if non-RTMP players start playing!
If you implement this method, make sure that if you want to allow playback, finally you need to call invokePrevious(Object, IClient, RequestFunction, AMFDataList).client - the object representing the playerfunction - not sure..params - a data object passed by the encoder, this can be used to find out the stream nameprotected static java.lang.String getParamString(AMFDataList paramAMFDataList, int paramInt)
AMFDataList objects that you get in play/connect/publish methods.
There are some constants defined in ModuleBase that are useful: PARAM1, PARAM2, PARAM3, which map to some other integers.
In play(IClient, RequestFunction, AMFDataList) and publish(IClient, RequestFunction, AMFDataList), you can extract the stream name as string with PARAM1paramAMFDataList - the object from which you want to extract the dataparamInt - the identifier of the parameter that you need.protected static void invokePrevious(java.lang.Object paramObject,
IClient paramIClient,
RequestFunction paramRequestFunction,
AMFDataList paramAMFDataList)
paramObject - from the examples, it looks like you just need to pass your own module instance, so pass literally thisparamIClient - pass on the IClient instance that you have received in your lifecycle methodparamRequestFunction - pass on the RequestFunction instance that you have received in your lifecycle methodparamAMFDataList - pass on the AMFDataList instance that you have received in your lifecycle method