Twitch viewer - not showing offline


I just need a little help or pushed in the correct direction. I don’t understand why it’s not showing the players that are offline. Thanks!


A couple of issues

  1. Offline players won’t have in their JSON, so when your code checks for that before checking for == null, you get an error because it doesn’t exist. Use .hasOwnProperty() to check for the existence of properties, or check for null first.
  2. if == null, then won’t exist (stream is null). You’ll likely need to use the /channels/ endpoint to get the display name of an offline user.


Thank you! I knew that offline players wouldn’t have but for whatever reason, I just kept confusing myself.