Wowza Community


Basically I think you need to deal with the confusing model. I have not studied it at length but my understanding is exactly as you have described. I do not know any short cut to simplify the processing and there are no other internals in Wowza that you can key off of to extract similar info.

My understanding is that you can just ignore onPause and focus on onPauseRaw. onPauseRaw is the indication of how much time a user is watching a stream. You will not be able to pin point exactly what they are watching. But should be able to remove the pause times from the total time watched.

I hope this helps.



I am facing problems using the IMediaStreamActionNotify2 interface.

I am trying to create a module which logs the actual time for which a client watched a stream to maintain a log in the DB so that i can charge the clients for only the time for which they watched streams on my site. IClient.elapsedTime() does not work for me as it includes the time for which the stream was paused… and i do not wish to charge the clients for the time they spent in paused state. I am using flowplayer as the client. To compensate the limitation imposed by the IClient.elapsedTime() method (limitation in my scenario is that it includes the paused time too. )… i added my implementation of the IMediaStereamNotify2 interface…( implementing all the methods…) as a clientListener in the onStreamCreate method.

I now have notifications to the onPause and the onPauseRaw methods / events… and was hoping that listening to these events would solve my problem.

However, this is where my dilemma starts… when i pause the playback in flowplayer, the onPauseRaw method is called… (the onPause is not caused and the IMediaStream.isPlaying() returns a true… i am guessing this is cause the stream is getting buffered…) if i press the pause button in flowplayer to unpause the playback… it calls the onPauseRaw method only if the buffering has not stopped. If the buffering stops while the playback is paused… then the onPause method is called when the buffering stops… and is called again for the second time when i press the unpause button in flowplayer. I think this is a bug of some sort as the onPauseRaw method is supposed to be called when the client flash player requests a pause.

Basically the way the onPauseRaw and the onPause methods are called gets a bit too confusing and seems they are called out of sync with what actually is going on.

I am hoping someone can help me figureout a reliable way to find the actual time a stream was watched… is there an alternate way to achieve that?

is there a definite order in which the onPause and the onPauseRaw methods are called?

i can provide further details on request.

any help or guidance will be much appreciated. I believe a pay as you watch module would be very helpful addition to the existing arsenal of the modules wowza has.



This is the kind of thing that you have to work through yourself. Test out your assumptions, see what works.


Referring to post at top of this thread, the onStreamCreate event handler is demonstrated inside the body of a Wowza application module (extends ModuleBase). This is how it is done.

Are you trying to use onStreamCreate in a Java class that does not extend ModuleBase? I’m not sure. I think you need that context, that is the way to do it, as shown.


IMediaStreamActionNotify2 is only relevant to Flash streaming.

There isn’t much similar for iOS. There is onHTTPCupertinoStreamingSessionCreate and onHTTPCupertinoStreamingSessionDestroy. See these examples:


No, it doesn’t work for Flash, as noted in previous post in this thread. See the links in that post.


Thanks for the quick reply Charlie.

Was hoping for a better option… but i guess now i will have to spend the weekend trying to work through the quirks.

I did try to ignore the onPause and concentrate only on the onPauseRaw method after my initial investigation, but it seems that if the buffering is complete… then the onPauseRaw method is completely ignored… and the pause / unpause events on the client start triggering the onPause method only.



I added 4 flags to my implementation of IMediaStreamActionNotify2 and used them to capture the exact flow of events… and ironed out all the quirks. After 4 hrs of load testing done by 3 clients simulating 1000 pause and unpause events… i feel that it is safe to say that it works perfectly now. :slight_smile:

Mission accomplished! (at-least for now)



According to the API the method onStreamCreate(IMediaStream stream) is in the interface IModuleOnStream. The code is working.


class ModuleMediaStreamActionNotify2Example extends ModuleBase!

It doesn’t say implements IModuleOnStream.

How do I get the reference to that method onStreamCreate(IMediaStream stream)?

Can u give me a hint?


I tried this implementation to listen to iPhone stream events, but it is not working. Are there any limitations of IMediaStreamActionNotify2 for iOS (v4.1)?

Does IMediaStreamActionNotify2 work for HTTP On Demand streaming? I don’t seem to get the example mentioned above to work. The onStreamCreate triggers correctly but the StreamListener doesn’t respond to the onPlay onPause etc. callbacks.