codec#on_event api change

Fixes #2140