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
- Offline players won’t have
data.stream.stream_typein their JSON, so when your code checks for that before checking for
data.stream == null, you get an error because it doesn’t exist. Use
.hasOwnProperty()to check for the existence of properties, or check for
data.stream == null, then
data.stream.display_namewon’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 data.stream.stream_type but for whatever reason, I just kept confusing myself.