Why not directly pass `onEnded`