yeah I think you are right, it should be:
var player = $("#twitch_embed_player")[0];
but this still doesn’t change anything about the fact (at least in my case) that the script never jumps into the onPlayerEvent function/section so this line is actually never reached.