Pay-per-view control for per-user access

Wmsauth_flow_ppv-250w Wowza-pay-per-view-250w Paywall-structure-250w

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 provides a framework for Wowza 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:

  1. Implement PPV API handler which is able to accept POST requests.
  2. Set up handler parameters within WMSPanel.
  3. Add PPV signature into existing media links.
  4. Enable PPV signature process via WMSPanel.
Having all that the general workflow would be as follows:
  • WMSPanel agent on Wowza server side sends request to handler on a periodical. The sync contains all users' IDs, IPs, view time and media names.
  • Customer handler makes required decisions based on company business logic and sends response to an agent. This response specifies which users must be blocked for 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. The agent 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.

Please check a very simple basic example for PHP. It just takes incoming request, logs it and returns a couple of IDs to be blocked. You should take a look at full JSON agent request example. and a handler response sample as well.

2. Set up API parameters for handler

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

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 agent to start sending requests, some changes must be made on your web server side.Media URL needs to be modified to include special hash, or signature, that would contain required information.

For example, you have this URL for your live stream:
rtsp://ec2-test-ip.compute.amazonaws.com:1935/live/Stream1
The modified URL would be:
rtsp://ec2-test-ip.compute.amazonaws.com:1935/live?wmsAuthSign=c2VydmVyX3RpbWU9NS80LzIwMTIgODozMzowNSBBTSZoYXNoX3ZhbHVlPXE3MjN6aEVmdGFUOUJoWjBQTmw1TVE9PSZ2YWxpZG1pbnV0ZXM9MjA2/Stream1

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

Click here to see the sample code.

You can find all samples in WMSPanel API samples github repository and adapt them for your use case.

Two important things must be specified here:

  • user ID defined by the customer;
  • key, or password, which is going to be used on the next step.
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, the agent must be notified about it. The set up is made via WMSAuth feature set.

Top-menu-half

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 Wowza servers to it. Check this screenshot for details.
Groups-list-half
2_server_selection-half

WMSAuth rule

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

5_wowza_entities-half

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 media signature" above.
After you save the rule, it will be applied to the server within a few seconds.
Hot-link-protection-half

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.

What if WMSPanel is not accessible?

Wowza agent 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.

Any other questions or problems?

Check the FAQ. Please also check company forum to see common questions and answers from other companies.

Use it with other products

Additionally you can find useful The Paranoid’s Guide to Internet Video Streaming by Thomas Gires to see real-life example of using Nimble Streamer pay-per-view feature set for HLS re-streaming via light-weight edge. You can use both Nimble Streamer and Wowza to work in a single efficient infrastructure to deliver HLS, SmoothStreaming and progressive download.

You may also set this functionality working with geo-location and IP ranges restriction and connections and bandwidth limitation.

Pay-per-view framework is also available in Nimble Streamer. Nimble Streamer is a light-weight HTTP streaming server for HLS, and other HTTP-based streaming
You can use it as efficient edge and origin server for live and VOD HLS.
Read this instruction to see how to use it there.