Push tokens through stream keys
What is live streaming with tokens
Live streaming with tokens allows you to give your streamers some security in their RTMP/SRT/WebRTC push url while at the same time allowing for a more user friendly stream name for viewers/channels. The default for RTMP is that the stream name returns in the push url. While handy this does open it up for people to "hijack" the stream as the push url is easily guessed.
Using tokens allows you to use complicated stream keys to push, while keeping the stream name within MistServer easy to use & user friendly. With MistServer 3.7 you can now use the stream keys feature to do this from a simple interface.
Requirements
- MistServer 3.7+
- Setting up a stream key
- (Optional) Setting up a stream to only allow stream key pushes
- Pushing to the stream key using RTMP
- Pushing to the stream key using SRT
- Pushing to the stream key using WebRTC
For the examples below we will be assuming MistServer is running on its default protocols 1935
for RTMP, 8889
for SRT and 8080
for HTTP. If you are using different ports please make sure you will have to add or adjust the port numbers.
1. Setting up a stream key
Setting up a stream key can be done from the streams
panel.
You should find a stream key button at the top of the page:
From there we can create a stream key and have MistServer generate a token. A stream key
does not need to be created for a stream name
that is configured within MistServer. That stream will then be created on the fly using MistServers default live stream configurations. This is most likely good for most users.
You can click on the stream key to copy it
Or we can click on the stream name and configure the stream for the optional step 2.
2. (Optional) Setting up a stream to only allow stream key pushes
If you come here from Step by clicking the stream name and pressing the create stream button you'll notice that all information is already set up. Even the stream key information, though it is hidden at a tab that you can unfold. When you do you'll see something like this:
Should this be your starting point you will have to fill in all information. You will need to fill in push://
as a source as otherwise you won't get access to the stream key
tab.
You can now set any optional parameters as well. Should you later use this stream name
to point wildcard
streams towards they will inherit these settings as well.
3. Pushing to the stream key using RTMP
For this example we'll use OBS, but the steps to follow should be comparable with any other application capable of pushing RTMP.
All you need to do is fill in the stream key
instead of the stream name
:
- URL:
rtmp://mistserveraddress/live/
- Stream key:
9p6iKigoFluD1WcUeRtp3pNTxpvp0fMQ
Once you start streaming you should see your stream active both in the stream keys panel
and the streams panel
.
When a stream is not set up it will be colored blue. This means it'll exist for as long as the stream is live. Afterwards it will remove itself from the list. You can right click and create the stream to make the set up permanent, but it isn't needed.
Some applications might not have a stream key
field, in that case just add a /
and the stream key
to give it the full RTMP address:
- Full address:
rtmp://mistserveraddress/live/9p6iKigoFluD1WcUeRtp3pNTxpvp0fMQ
4. Pushing to the stream key using SRT
For SRT you'll need to make sure you target the stream key using the streamid
parameter from the SRT protocol. using the example that would be:
srt://mistserveraddress:8889?streamid=9p6iKigoFluD1WcUeRtp3pNTxpvp0fMQ
For OBS you will want nothing filled in the stream key field.
If there is a passphrase set up for the SRT protocol within the MistServer protocols tab you will still need to include this as this is the passphrase to allow the SRT connection to be made. Stream keys will not be able to bypass this.
5. pushing to the stream key using WebRTC
For WebRTC you'll need to target the HTTP or HTTPS port. And use the following syntax:
http://mistserveraddress:8080/webrtc/9p6iKigoFluD1WcUeRtp3pNTxpvp0fMQ
or
https://mistserveraddress:5544/webrtc/9p6iKigoFluD1WcUeRtp3pNTxpvp0fMQ
(Want to know how to set up HTTP? Look here!)
Sometimes the stream key
used could be going through something that removes upper/lower case. If you spot a stream key not working try making one with only lower case!