Reference¶
/display
¶
Updates and returns the new state of the display.
Optional Parameters:
Name | Type | Description |
---|---|---|
large_channel | string | Sets the channel name of the large screen. This screen is the always visible main screen. Set to empty to disable (see examples). |
small_channel | string | Sets the channel name of the small screen. This screen is a small Picture-in-Picture like screen in the top right corner. Set to empty to disable (see examples). |
volume | float | Sets the volume of the large screen. Set to 0 or 0.0 to mute.Values are in the range of 0.0 - 1.0 .Note: The small screen is always muted. |
small_scale | float | Sets the scale (size) of the small screen. The value is relative to the width of the large screen. Reasonable values are in the range of 0.2 - 0.5 .It is best to just experiment with this setting. |
show_chat | bool | Sets whether the chat should be shown or not. Accepts true and false . |
Note
All parameters are optional and can be combined. If none are supplied no updates are done and the current state gets returned.
Returns DisplayState
.
Examples
-
Only set the large_channel to riotgames
http://localhost:8080/display?large_channel=riotgames
/* JSONObject newState = */ client.display("riotgames", null, null, null, null);
-
Set the large_channel to monstercat, disable the small_channel, set the volume to 0.8 and hide the chat.
Notice the small_scale is not changed (because of its absence)http://localhost:8080/display?large_channel=monstercat&small_channel=&volume=0.8&show_chat=false
/* JSONObject newState = */ client.display("monstercat", "", 0.8f, null, false);
/twitch
¶
/twitch/getTopGames
¶
Gets the most popular games on Twitch right now.
No Parameters
Returns Game
array.
Examples
- Get top games
http://localhost:8080/twitch/getTopGames
List<JSONObject> topGames = client.twitchGetTopGames();
/twitch/searchGames
¶
Searches games by query.
Parameters:
Name | Type | Description |
---|---|---|
query | string | What should be searched. Required |
Returns Game
array.
Examples
-
Search for the "game" Talk Shows & Podcasts
http://localhost:8080/twitch/searchGames?query=talk%20show
List<JSONObject> foundGames = client.twitchSearchGames("talk show");
-
Search for ove (will show games starting with "ove" like Overwatch)
http://localhost:8080/twitch/searchGames?query=ove
List<JSONObject> foundGames = client.twitchSearchGames("ove");
/twitch/getTopStreams
¶
Gets the most popular streams on Twitch right now. Optionally filter by channels, game and language.
Optional Parameters:
Name | Type | Description |
---|---|---|
channels | string | Specify up to 100 channels separated by , that the search should be limited to.See the examples why that would be useful. |
game | string | Specify a game that the search should be limited to. |
language | string | Specify a language that the search should be limited to. |
Note
All parameters are optional and can be combined. If none are supplied the top streams for all channels, games and languages are returned.
Returns Stream
array.
Examples
-
Get the unfiltered top streams
http://localhost:8080/twitch/getTopStreams
List<JSONObject> topStreams = client.twitchGetTopStreams(null, null, null);
-
German top streams
http://localhost:8080/twitch/getTopStreams?language=de
List<JSONObject> topStreams = client.twitchGetTopStreams(null, null, "de");
-
English top streams in Talk Shows and Podcasts
http://localhost:8080/twitch/getTopStreams?language=en&game=Talk%20Shows%20%26%20Podcasts
List<JSONObject> topStreams = client.twitchGetTopStreams(null, "Talk Shows and Podcasts", "en");
-
Tip: If your app implements a favorite list you can very easily query these channels and see who is streaming and other information
http://localhost:8080/twitch/getTopStreams?channels=xqcow,dafran,kitboga
String[] favoriteChannels = {"xqcow", "dafran", "kitboga"}; List<JSONObject> topStreams = client.twitchGetTopStreams(favoriteChannels, null, null);
/twitch/getFeaturedStreams
¶
Gets the featured streams on Twitch's homepage.
No Parameters
Returns Stream
array.
Examples
- Get featured streams
http://localhost:8080/twitch/getFeaturedStreams
List<JSONObject> featuredStreams = client.twitchGetFeaturedStreams();
JSON Structures (by Example)¶
DisplayState¶
{
"large_channel": "xqcow",
"small_channel": "",
"volume": 0.75,
"small_scale": 0.25,
"show_chat": true
}
Game¶
{
"name": "Grand Theft Auto V",
"viewers": 118716,
"box_img_url": "https://static-cdn.jtvnw.net/ttv-boxart/Grand%20Theft%20Auto%20V-272x380.jpg",
"logo_img_url": "https://static-cdn.jtvnw.net/ttv-logoart/Grand%20Theft%20Auto%20V-240x144.jpg"
}
Stream¶
{
"average_fps": 60,
"started_at": "2019-08-20T19:54:47Z",
"game": "Fortnite",
"preview_img_url": "https://static-cdn.jtvnw.net/previews-ttv/live_user_tfue-640x360.jpg",
"video_height": 1080,
"viewers": 42870,
"status": "High Kill Solos",
"language": "en",
"mature": false,
"channel_name": "tfue",
"channel_display_name": "Tfue",
"channel_logo_img_url": "https://static-cdn.jtvnw.net/jtv_user_pictures/2470b5c6-a737-4ba6-8987-c28e0ca839e1-profile_image-300x300.jpg"
}
Note
- The image at the
preview_img_url
url updates itself every couple of seconds. If the app uses preview images it could also. started_at
is an ISO 8601 timestamp.video_height
:1080
=HD
,< 1080
=SD
,> 1080
=UHD
.mature
: If the stream is meant for mature audiences (set by the streamer themselves as a guideline).