Wowza stream time measurement without spamming additional threads
Hi, I've just asked a question on stackoverflow, but I guess here is also good to ask.
I'm trying to write module which will monitor how long did user watch stream. It's not live stream, but a video on demand.
My question is what is most efficient way to do so. I went this route:
created class that implements IMediaStreamActionNotify2 and then when onPlay event is triggered I would create new thread that would periodically check for elapsed time since the start of the stream and update duration variable.
This is the way I decided to run additional thread:
BalanceTimerMonitor btm = new BalanceTimerMonitor(...);
Now all of this works, but I'm concerned about amount of new threads created for every stream, since I assume that each stream already runs as separate thread from main wowza app. Will this big amount of threads slow down my server? Is there another more elegant way of measuring stream duration?