Updating channel in player

<script src= "http://player.twitch.tv/js/embed/v1.js"></script>
<div id="SamplePlayerDivID"></div>
<script type="text/javascript">
var options = {
	width: 854,
	height: 480,
	channel: "dallas",
};
var player = new Twitch.Player("SamplePlayerDivID", options);
player.setChannel("esl_csgo");
</script>

I have this code which in theory should create a twitch player, and immediately change it to the channel esl_csgo. For some reason it doesn’t work, any help?

Set the channel to esl_csgo first.

At a guess (without testing), you are trying to change channel tooooooo soon. And the player isn’t ready to accept channel changes yet.

Are you getting any console errors?

Thanks for replying Barry. I understand I can just set the channel in the settings, but I’m only using this script to test how updating the channel player works since when I use the script in the future I’m going to be constantly changing the channel. I don’t think the player being ready is the issue, since I tested it with changing the channel on right arrow key down and I gave it ample time and it still didn’t work. I’m not getting anything in console. Any ideas?

Its also really weird since I basically pulled this code directly from the twitch api documentation.

Bump

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.