Building paywalls with pay-per-view control

Some businesses want to control their streaming process on per-user and per-stream level in addition to general protection methods like
hot-link protection
or
geo restriction
limitation. This is required especially for
pay-per-view (PPV)
systems where viewers pay for accessing the media.

What can we do?

WMSPanel and
Nimble Streamer
provide a framework which allows collecting detailed data for all connection and making decision to allow or deny each connecting user. This may be used for
pay-per-view
and
pay-per-minute
logic, calculating each
user simultaneous connections,
stats for
unique visitors
and much more.

These are the steps for a customer to integrate those capabilities into customer's workflow:

Implement PPV API handler which is able to accept POST requests.

Set up handler parameters within WMSPanel.

Add PPV signature into existing media links.

Enable PPV signature process via WMSPanel.

Having all that the general workflow would be as follows:

Nimble Streamer sends request to handler on a periodical basis. The sync contains all users' IDs, IPs, delta of view time between sync-ups and media names.

Customer handler makes required decisions based on company business logic and sends response to Nimble. This response specifies which users must be blocked from watching media.

Blocked users are shut down immediately, while others keep watching.

So let's go step by step to implement it.

1. Create PPV handler

WMSPanel uses
push API.
Nimble sends requests to customer's handler. This handler must be accessible via HTTP/HTTPS and it must be able to accept POST requests. Those requests may be formed via either
JSON or XML,
this can be set up in WMSPanel settings.
Handler needs to do a few things:

parse incoming request (e.g. decode JSON document);

make query to internal users database to append consumption updates and make decision about who may keep accessing the media (e.g. watch video);

return encoded response which contains users' IDs that must be blocked from accessing the media.

Handler needs to return list of all blocked IDs on every sync. If some ID is excluded from the list, it will be allowed to access.

2. Set up API parameters for handler

Now we need to set up a link between Nimble Streamer instances and the handler. Select
Control / API setup
menu and select
Push API tab
which is the one we are going to use now.

Define the following:

Enter handler URL into
PPV handler URL
field;

Click on
Enable pay per view
check box;

Select
Request format
or leave default "JSON" value;

Enter
Sync interval
or leave default 30 seconds.

A few seconds after you click on
Save,
the first sync-up will be sent to your handler.

3. Make PPV signature

In order for Nimble to start sending requests, some changes must be made on your web server side. Media URL needs to be modified to include special
signature,
that would contain required information.

For example, you have this URL for your live stream:
http://video.wmspanel.com:8081/vod/sample.mp4/playlist.m3u8
The modified URL would be:
http://video.wmspanel.com:8081/vod/sample.mp4/playlist.m3u8?wmsAuthSign=c2VydmVyX3RpbWU9NS80LzIwMTIgODozMzowNSBBTSZoYXNoX3ZhbHVlPXE3MjN6aEVmdGFUOUJoWjBQTmw1TVE9PSZ2YWxpZG1pbnV0ZXM9MjA2

To generate signature you need to modify your front-end source to include code snippet.

The ID is any string value which is unique within customer's scope. The code is the same as the code
used in hot-linking protection
except for the IP which is replaced with ID here.

4. Set up PPV signature settings

To define restriction settings on server side,
Nimble Streamer
must be notified about it. The set up is made via WMSAuth paywall setup.

WMSAuth group

In WMSAuth, every restriction may be applied to a group of servers. So the first thing to do is to create a group and assign one or more Nimble servers to it. Check this screenshot for details.

WMSAuth rule

Within a group, there may be several rules, each working with its
set of streams.
Just click on "Add rule" to enter rule creation page.
See how you can specify Nimble
streams
regular expression on the screenshot below.

Set up password

Now you need to specify
a key, or password,
which was inserted into the media signature on web server side in section "Make PPV signature" above.
After you save the rule, it will be applied to the server within a few seconds.

Are there any debugging techniques available?

The debugging handler and interface
allows receiving data from servers and viewing results via your browser. Use it to see what requests will come from your server instances to your own handler.

That's it

Now when the chain is set up you will be receiving updates on current streaming status. As response you can send back the blocked IDs list and so control your streaming workflow.

Example

What if WMSPanel is not accessible?

Nimble Streamer will send requests and receive responses for pay-per-view framework regardless of WMSPanel availability. If your server can't connect to WMSPanel for some reason, this functionality will still work perfectly. Once the handler settings are set up, the control panel is not used anymore.