The original code attempted to unregister the "playing" callback, but it passed the wrong useCapture flag, so the callback would be called each time the video looped. This is an attempt to fix that bug.

I agree that with your suggested structure, maybeCallCallback can unregister the callbacks itself. That hadn't occurred to me. I'll make this change.