Skip to content
Snippets Groups Projects
quickstart.md 2.77 KiB
Newer Older
  • Learn to ignore specific revisions
  • # Quickstart <small>(learning by doing)</small>
    
    ```bash
    
    $ ./stream-server
    
      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`.
    
    1. Open <http://localhost:8080> in a browser. Leave this tab / window open while you do the other steps.
    
    2. Get the current state of the display:
    
        <pre><code><http://localhost:8080/display></code></pre>
    
        ``` java
        StreamServerClient client = new StreamServerClient("10.0.2.2:8080");
    
        JSONObject state = client.display(null, null, null, null, null);
    
        !!! example
            ``` json
            {
    
                "large_channel": "",
                "small_channel": "",
    
                "volume": 0.5,
    
                "show_chat": false
            }
            ```
    
    3. Find some stream on twitch:
    
    
        <pre><code><http://localhost:8080/twitch/getTopStreams></code></pre>
    
        ``` java
        List<JSONObject> topStreams = client.twitchGetTopStreams(null, null, null); // no filters
    
        ```
    
        !!! example
            ``` json
            [
                {
                    "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"
                },
                ...
            ]
            ```
    
    
    4. Start playback of your selected stream with chat and muted volume:
    
        <pre><code><http://localhost:8080/display?large_channel=CHANNEL-NAME&volume=0&show_chat=true></code></pre>
    
        ``` java
    
        client.display("CHANNEL-NAME", null, 0.0f, null, true);
    
        ```
    
        !!! example
            ``` json
            {
                "large_channel": "riotgames",
    
                "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.
    
    5. Read the [Reference](reference.md).