In this guide, you will learn how to correctly configure all the stream settings for the "gateway" configuration method. You will also find all the parameters that the library can accept, along with their explanations.
The gateway method is an alternative to the Embedded configuration and does not require embedding stream data within the config object. Instead, a template containing all stream data (including alternative server list, multiple quality/sources, quality labels etc.) is pushed to the origin server and automatically copied to all edge servers.
For Storm Streaming Cloud all that happens automatically. If you’re about to setup your own streaming cluster using Storm Streaming Server you’ll need to setup an instance with at least one Origin-type application and one Edge-type application (linked together).
Check our Guides for Origin and Edge Applications to learn more.
Thanks to this approach, there is no need to set all stream data for every scenario manually. It is also possible to use inbuilt load-balancing functionality since servers themselves will know which one is under the lowest load or stopped working due to a malfunction.
const streamConfig = {
configurationType: "gateway",
stream: {
serverList: [{
host: "yourdomain.com",
application: "live",
port: 443,
ssl: true
}],
streamKey: "test",
},
settings: {
autoStart: true,
video: {
containerID: "containerID",
width: "100%",
aspectRatio: "16:9"
}
}
}
//This sample uses IIFE embed method. Creating library instance will look slightly different for AMD, UMD or ESM
const storm = stormLibrary(streamConfig);
Parameter name | Parameter type | Required | Default | Description |
---|---|---|---|---|
configurationType | string | yes | - | This parameter defines whether we are dealing with an 'embedded' or 'gateway' type configuration. |
serverList[host] | string | yes | - | A hostname of a Storm Server instance. Since most browsers require SSL for WebSocket connection, using an IP Address is not recommended. |
serverList[application] | string | yes | - | A name of an application within the Storm Streaming Server or Storm Cloud instance. |
serverList[port] | number | no | 80 for non-ssl and 443 for ssl | To avoid issues with network firewalls, please use 80 for non-ssl connections and 443 for ssl connections. |
serverList[isSSL] | boolean | no | true | Indicates whether SSL connection should be used or not. |
streamKey | string | yes | - | StreamKey of your stream. Usually, a single StreamKey represents a group of streams. |
It is possible to define several servers in the configuration object as backup, however the client might end-up connecting to edge server provided by the gateway.
Example:
serverList: [{
host: "sub1.yourdomain.com",
application: "live",
port: 443,
ssl: true
},
{
host: "sub2.yourdomain.com",
application: "live",
port: 443,
ssl: true
},
{
host: "sub3.yourdomain.com",
application: "live",
port: 443,
ssl: true
}
]
Just like with the server list, we can add more than one stream source. This gives us two possibilities. If for some reason a given stream doesn't work, Storm Library will simply try to use the next one. We can also use this functionality to launch Adaptive Bitrate Streaming.