Quickstart (learning by doing)¶
$ ./stream-server
Serving on
http://localhost:8080
http://10.0.2.15:8080
Read the quickstart at https://stream-server.h-da.io/quickstart to get started.
Stop with Ctrl-C or close this terminal.
Note
In the examples of this documentation only the local address is used. If you want to connect from your phone or the emulator you need to use the network address (192.168.0.66 in this case). Also we assume you use the default port 8080.
- Open http://localhost:8080 in a browser. Leave this tab / window open while you do the other steps.
-
Get the current state of the display:
http://localhost:8080/displayStreamServerClient client = new StreamServerClient("10.0.2.2:8080"); JSONObject state = client.display(null, null, null, null, null);Example
{ "large_channel": "", "small_channel": "", "volume": 0.5, "small_scale": 0.3, "show_chat": false } -
Find some stream on twitch:
http://localhost:8080/twitch/getTopStreamsList<JSONObject> topStreams = client.twitchGetTopStreams(null, null, null); // no filtersExample
[ { "average_fps": 60, "started_at": "2019-08-18T17:29:55Z", "game": "League of Legends", "preview_img_url": "https://static-cdn.jtvnw.net/previews-ttv/live_user_riotgames-640x360.jpg", "video_height": 1080, "viewers": 226699, "status": "TL vs. CG | Semifinals Day 2 | LCS Summer Split | Team Liquid vs. Clutch Gaming (2019)", "language": "en", "mature": false, "channel_name": "riotgames", "channel_display_name": "Riot Games", "channel_logo_img_url": "https://static-cdn.jtvnw.net/jtv_user_pictures/889e7697-b636-48d9-be15-a9a39e286a64-profile_image-300x300.png" }, ... ] -
Start playback of your selected stream with chat and muted volume:
http://localhost:8080/display?large_channel=CHANNEL-NAME&volume=0&show_chat=trueclient.display("CHANNEL-NAME", null, 0.0f, null, true);Example
{ "large_channel": "riotgames", "small_channel": "", "volume": 0, "small_scale": 0.3, "show_chat": true }The tab / window from step 1 should now start playing that stream with the provided settings.
-
Read the Reference.
Last update: June 20, 2020