Skip to main content

View tokens and an example

What is viewing with tokens

Viewing with tokens means locking playback of media behind some sort of ticketing system. Viewers will need to provide a token in some way in order to view the stream. In turn this token should then be locked in order to not allow multiple users use the same token. However you do need to keep a few things in mind as a user could disconnect and reconnect, that should be allowed.

Here we'll give you an example and some ideas on how to set up a system that can handle this yourself.

Requirements

  • MistServer 3.0+
  • SQLite
  • sqlite3, jq,
  • sed, cut, head, tail (included in Busybox and most Linux installs)

Steps we go through in this guide

  1. Determine how tokens should work
  2. Setting up the database
  3. Setting up triggers
  4. Configuring MistServer
  5. Using the system

1. Explaining the situation

In order to use view tokens properly we'll need to determine both how the tokens should work and what would and wouldn't be allowed. Then there's also what we need to be able to use tokens for:

  • We need to create
  • We need to "catch" the token when a viewer connects
  • We need to lock a token
  • We need to unlock a token
  • We need to allow viewing based on the token status