Set Up Cluster and Extension

Before You Begin

This section assumes that:

Before getting started, you also need:

Edit the Terraform Configuration

You will need your address, stream key, and channel. More information on how to get them in the Configuring Live Streaming section of the Twitch Setup page.

You have two choices here:

  1. Edit twitch.sample.hcl which is located in \samples\streaming_services.

    version = "1.7.0"
    
    settings {
        encode {
        stream {
          enable  = true
          service = "twitch"
          // YOU MUST CHANGE THE ADDRESS, CHANNEL AND KEY VALUE
          addr    = "rtmp://<twitch-ingest-server>/app"
          channel = "channelname"
          key     = "live_NNNNNNNN_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
        }
      }
        leaf {
        port = 30001
      }
    } // end of settings
    
    link "button" {
      name     = "Twitch Channel"
      template = "http://twitch.tv/${key `genvid/encode/stream/channel`}"
    } // end of link "twitch"
    
    config {
      embed_ssl {
        enabled = true
      }
    } // end of config
    

    You can then load it with the following command if using a local cluster:

    genvid-sdk load-config twitch.sample.hcl
    

    If using a cluster on the cloud:

    genvid-sdk -c [clusterid] load-config twitch.sample.hcl
    

    A new button TWITCH CHANNEL will appear that will redirect you to your Twitch channel. To test the embedded stream on the website just click on CUBE SAMPLE

    Cluster UI Jobs Page Twitch
  2. Or you can manually enter the parameters in the Cluster UI Settings page.

../../../_images/cluster_ui_settings.png

But in both cases you will then need to edit your secret key in twitchsecret.sample.hcl located in \samples\cube\twitch-extension\config.

version = "1.7.0"

secrets {
    twitch {
        TWITCH_EXT_CLIENT_SECRET = "ENTER_YOUR_TWITCH_EXT_CLIENT_SECRET"
    }
}

And then load it with the following command if using a local cluster:

genvid-sdk load-config twitchsecret.sample.hcl

Or if using a cluster on the cloud:

genvid-sdk -c [clusterid] load-config twitchsecret.sample.hcl

Warning

Whether you’re using SSL on a cloud or a local cluster, if you want to stream Twitch embedded on the website you will still need to load ‘twitch.sample.hcl’ located in ‘\samples\streaming_services’. If you load ‘twitch.sample.hcl’ before loading the web sample, the web sample will overwrite the value associated with the ‘embed_ssl’ from the ‘web.hcl’ file.

Start the DirectX Sample

  1. Go to the /samples/cube/directx directory.

  2. Copy the Genvid files used to build the project.

    py directx.py prepare
    
  3. Build the project.

    py directx.py build
    
  4. Load the sample.

    py directx.py load
    
  5. Go to the /samples/cube/web directory.

  6. Build the website.

    py web.py build
    
  7. Load the website.

    py web.py load
    

    When using an SSL module with your cluster, a leaf endpoint and a web endpoint are created. These endpoints are loaded in the configuration of your cluster with the method loadEndpoint() when you load the website.

    You can find the key values for these endpoints in your cluster settings:

    Cluster UI Settings Page
  8. Launch the Cluster UI.

    genvid-sdk monitor
    
  9. Click the Jobs tab.

  10. Click START ALL.

    Cluster UI Jobs Page

Create a Twitch Extension

Note

This information is dependent upon systems maintained by Twitch. We do our best to keep it updated, but you should see the Twitch developer documentation for the latest information.

  1. Open your Twitch Developer Account.

  2. Click Your Dashboard.

  3. Click Create Extension.

  4. Choose a name for your extension. (It can be anything.)

  5. Click Continue.

  6. Under Create an Extension Version select Panel and Video - Fullscreen.

  7. Enter something in Summary.

  8. Click Create Extension Version.

The Genvid SDK uses the Twitch Extension Configuration Service, so you need to activate it.

  1. Select the Capabilities tab.

  2. Under Select how you will configure your extension select Extension Configuration Service.

  3. Click Save Changes.

Associate the Twitch Developer Rig with Your Extension

  1. Open your Twitch Developer Rig.

  2. Log in using your Twitch Account Credentials, if necessary.

  3. Click Add Project.

    Note: If this is the first project you’ve created, click Create Your First Project and skip the next step.

  4. Click Create Project.

  5. In the first drop-down menu under Select Existing or Create New Extension, select the Twitch Extension you just created.

    Note: If you don’t see it, click the Refresh button.

  6. Click Next.

  7. Select the folder for your Twitch Extension project.

    Note: In this case, it is samples\cube. In general, it has to be the parent of the folder where your files are served.

  8. Select None - I’ll use my own code as your template.

  9. Click Next.

  10. Click Get Started.

    This creates a JSON file in your project folder with all information related to the dev rig and project.

Now your Twitch Developer Rig is ready to stream the DirectX Sample.