justintv / Twitch-API

A home for details about our API
www.twitch.tv
1.72k stars 381 forks source link

Player won't load - setChannel not working #510

Closed dylannz closed 8 years ago

dylannz commented 8 years ago

Hey - I set up some very simple pages based on the API examples to try and debug the problems we were having with Twitch's API:

https://andchill.tv/twitch-test.html https://andchill.tv/twitch-test2.html

One uses setChannel, one specifies the channel in the options object. The one with setChannel doesn't work for me, just loads forever.

Here's the JS:

var options = {
    width: 854,
    height: 480,
    channel: "esl_csgo", 
};
var player = new Twitch.Player("twitch-player", options);
player.setVolume(0.5);
var options = {
    width: 854,
    height: 480,
};
var player = new Twitch.Player("twitch-player", options);
player.setVolume(0.5);
player.setChannel("esl_csgo");

No errors, just never loads.

dylannz commented 8 years ago

With some more experimentation it appears a bunch of the API methods simply do nothing at the moment:

setVolume getCurrentTime setChannel pause

No idea why.

tadachi commented 8 years ago

So I believe setChannel() works if a channel is already set. However, if there is no valid channel set in the options then setChannel() doesn't work.

Is there a way to intialize the Interactive Twitch Video Player without loading a channel? Then use setChannel after a user picks a channel?

  var options = {
      width: 854,
      height: 480,
      //channel: "{CHANNEL}"
  };

  //Initialized with no channel set but available to setChannel()
  var player = new Twitch.Player("twitch-player", options); 

  // code....  

  // User click event to set channel
  player.setChannel("xerokynos");
dylannz commented 8 years ago

It gives no indication of failure, which suggests the behaviour is probably not what's expected. It really should work with an empty channel on initialisation.

lbrtmrtnz commented 8 years ago

similar to: https://github.com/justintv/Twitch-API/issues/534

Fingers crossed that this gets cleared up! ><

mrjumjum commented 8 years ago

This should be resolved now. @dylannz You're 2nd link now works. https://andchill.tv/twitch-test2.html

dylannz commented 8 years ago

Brilliant, thanks heaps!