After investigating some breakage reports, it turns out we needed to
make some more improvements to the YouTube "surrogate script":
Websites sometimes call YT.get() to find the YT.Player Object by the
element ID. If they call that trying to find a mock player after
the real API has loaded, we should handle that.
In handleDeferredVideoLoad codepath:
Handle addEventListener being passed a string containing listening
function's name, instead of the function itself.
Stub out some commonly used methods, taking care to also dispatch
state change events where necessary.
Ensure that event listeners passed through the config Object are
also used when dispatching fake load/play events.
Ensure that the state change event doesn't fire with UNSTARTED or
BUFFERING etc after the video is first unblocked, since that
causes some websites to think the video has been stopped.
After investigating some breakage reports, it turns out we needed to make some more improvements to the YouTube "surrogate script":