Thank you for your answer.
I think I didnt make clear enough which part isn’t working for me. Thats the code for now:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
<script>
$(function () {
window.onPlayerEvent = function (data) {
console.log("LOG: on PlayerEvent!");
data.forEach(function (event) {
console.log("LOG: foreach data");
if (event.event == "playerInit") {
console.log("LOG: playerInit!");
var player = $("#live_embed_player")[0];
player.playVideo();
player.mute();
}
});
}
console.log("LOG: test");
swfobject.embedSWF("http://www-cdn.jtvnw.net/swflibs/TwitchPlayer.swf", "twitch_embed_player", "640", "400", "11", null, {
"eventsCallback": "onPlayerEvent",
"embed": 1,
"channel": "dreamleague",
"auto_play": "true"
}, {
"allowScriptAccess": "always",
"allowFullScreen": "true"
});
});
</script>
</head>
<body>
<div id="twitch_embed_player"></div>
</body>
</html>
it’s pretty much copy&pasted from the player.md documentation…
To show what I mean I added some console log calls.
When the file is opened in Firefox, the player loads, the stream starts and i see the control log output “LOG: test”. But thats it. No more console log outputs. (and the stream doesn’t get muted, too)
Thats why I came to the conclusion that the function “onPlayerEvent” never gets called. Maybe I missunderstand the code and it’s fine that the function isn’t called - then I would be happy about a little explanation about how the callback actually works.