Imitating NetStream.publish() inside flash app

Hi.
Firstly, I was thinking about input from microphone only, but I’ve realized that if there will be a solution it may work both for sound and video… So, what I’m trying to do is to intercept the data sent by the publish() method and to write it into my bytearray. So that I will be able to form a file out of it later.
Wonder if anyone tried this before or has anything to say considering this idea.

I will greatly apreciate any of your inputs on this issue.