callback implementation of real time recording. Contain one example on how to use it