Set Up the Cluster and Extension
Before You Begin
This section assumes that:
You’ve previously set up a development environment for the Genvid MILE SDK.
You can run the DirectX Sample in the cloud.
Before getting started, you also need:
A Twitch Account for broadcasting your stream.
A Twitch Developer Account for creating your extension.
To have your Twitch Extension development environment set up.
A working local bastion and cluster.
Create a Twitch Extension for the DirectX Sample
See Create a Twitch Extension for how to create an extension to use with the sample.
Edit the Terraform Configuration
You will need your address, stream key, and channel. See the Configuring Live Streaming section of the Twitch Setup page for information on how to find them.
You have two choices here:
- Option 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 then need to load it to your cluster using the genvid-sdk command.
For a local cluster:
genvid-sdk load-config twitch.sample.hcl
For 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, click CUBE SAMPLE.
- Option 2
Manually enter the parameters in the Cluster UI Settings page.
In either case, you will need to edit your secret key in
twitchsecret.sample.hcl
located in the \samples\cube\twitch-extension\config
folder.
version = "1.7.0" secrets { twitch { TWITCH_EXT_CLIENT_SECRET = "ENTER_YOUR_TWITCH_EXT_CLIENT_SECRET" } }
Then you load it to your cluster using the genvid-sdk command.
For a local cluster:
genvid-sdk load-config twitchsecret.sample.hcl
For a cluster on the cloud:
genvid-sdk -c [clusterid] load-config twitchsecret.sample.hcl
You’ll also need to load the config.hcl
located in \samples\cube\twitch-extension\config
.
version = "1.7.0" settings { leaf { port = 30001 } services { leaf { websocketURLSuffix = "/socket" } } } link "twitch" { name = "Twitch Extension" template = "http://twitch.tv/${key `genvid/encode/stream/channel`}" } config { twitch_extension { enabled = true } }
Using the genvid-sdk command.
For a local cluster
genvid-sdk load-config config.hcl
For a cluster on the cloud:
genvid-sdk -c [clusterid] load-config config.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 the
\samples\streaming_services
folder. If you load
twitch.sample.hcl
before loading the web sample, the web sample will overwrite the value associated with embed_ssl from the
web.hcl
file.
Start the DirectX Sample
Go to the
/samples/cube/directx
folder.Copy the Genvid files used to build the project.
py directx.py prepare
Build the project.
py directx.py build
Load the sample.
py directx.py load
Go to the
/samples/cube/web
folder.Build the website.
py web.py build
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:
Launch the Cluster UI.
genvid-sdk monitor
Click the Jobs tab.
Click START ALL.