Embed: getQualities() returns empty array

I’m using the Embed library (https://dev.twitch.tv/docs/embed/video-and-clips), and getQualities() returns an empty array.

I’m calling this method after the player is ready. I am embedding a live, and the channel is live.

this.player.addEventListener('ready', () => {
    console.log(this.player.getQualities()) // Returns []
})

It’s possible for the player to be “ready” but not yet have the qualities available if it is not playing. I would recommend trying Twitch.Player.PLAYING instead of Twitch.Player.READY. This was the code I tested with and saw an empty array with “ready,” and a populated array with “playing.”

<script src= "https://player.twitch.tv/js/embed/v1.js"></script>
<div id="twitch_player"></div>
<script type="text/javascript">
  var options = {
    width: 640,
    height: 480,
    channel: "cohhcarnage"
  };

  var player = new Twitch.Player("twitch_player", options);

  player.addEventListener(Twitch.Player.PLAYING, function() {
    console.log(player.getQualities());
  });
</script>

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