add support for onEnd callback

Hi Chriso,

i added a feature to add an user callback when stream is ended.

hope you will like this