Stream keys
What are stream keys?
With MistServer 3.7+ comes the stream keys feature, they give users of Mistserver a new method of pushing live streams into MistServer. Stream keys allow you to push towards MistServer using a unique token which is linked to a stream name internally. Stream keys allow you to do the following:
- Set up a unique random token and link it to a stream name within MistServer
- Bypass triggers and password security (with the exception of protocol-level security, such as the SRT passphrase)
- Bypass any (potentially conflicting) source for the stream (as long as its not in active use)
- Optionally, set up streams to only accept pushes using a stream key
- Create streams on-the-fly by setting up a stream key for a non-existent stream
Setting up a stream key
Like all MistServer configuration, stream keys can be set up through either the interface, the API or by editing the configuration file.
Interface
Within the streams tab is a new button for the stream keys interface
Once in the stream key interface you will be able to see the current stream keys and create new ones
You can select a stream name and press generate or create one manually, then press add
Once added you will be able to see the new stream key:
You can click the stream name to (optionally) create it, or click the stream key to copy it for usage.
If the stream key is in use you will be able to see it here as well.
The same for the streams panel:
API
Request the list of stream keys
For more detailed information please look at the streamkeys api call page.
To request the current stream keys simply pass the value true
to streamkeys
.
{"streamkeys":true}
- Returns a list of stream keys as
{"streamkey":"streamname","streamkey":"streamname"}
Adding stream keys
For more detailed information please look at the streamkey_add api call page.
You can add a stream key by calling the streamkey_add
call and pass it a streamkey
and streamname
to create a stream key/name combination. You can add multiple keys/names at the same time.
{"streamkey_add":{"streamkey":"streamname"}}
example:
{
"streamkey_add": {
"UhFQ4DSYtSKOtX8NmUx1t1LFeJLllEBM": "stream_a",
"w7mhwcgHid5oCtdMRybPjrpl1JudDVsY": "stream_b"
}
}
Removing a stream key
For more detailed information please look at the streamkey_del api call page.
Deleting a stream key can be done by calling streamkey_del
with a relevant stream key. You do not need to pass the stream name its for as each stream key is unique by definition.
{"streamkey_del":"streamkey"}
{
"streamkey_del": "UhFQ4DSYtSKOtX8NmUx1t1LFeJLllEBM"
}
Configuration file
Within the MistServer configuration file there's "streamkeys"
field followed by a list of objects., you can add any "streamkey":"streamname"
to list of objects
"streamkeys": {
},
example:
streamkeys":{"9p6iKigoFluD1WcUeRtp3pNTxpvp0fMQ":"new_livestream","w7mhwcgHid5oCtdMRybPjrpl1JudDVsY":"live"}
Setting up stream keys into a stream
While every type of source can be bypassed using stream keys (provided the stream is currently inactive) we have only added the stream keys interface to streams that are using a push://
source.
You can generate/see the stream keys for this stream and/or force the stream to only allow stream keys to push into it. If you do not restrict a stream to stream keys only you will also be able to push into the stream using the stream name. Please make sure to tick the "require stream key" box if you want to avoid this.
There is no specific API call to set up a stream to only allow stream keys. Ticking the box will simply override the source
field to push://invalid,host
, technically making it an invalid push target, which then gets bypassed using the stream key.
Note regarding SRT passphrase
SRT passphrases are not bypassed by the stream key functionality as the SRT passphrase is a protocol-level feature. The SRT connection will be rejected if the passphrase is not valid before the stream key is given to MistServer to check. So if using SRT with both stream keys and SRT passphrase, you will need to have both a valid SRT passphrase and a valid stream key to get through.