Commerce Server Pay-Per-View Demonstration
Helix Server's commerce feature allows an administrator to restrict which users can access clips served by Helix Server. When Helix Server receives a request for secured content, it checks the list of authorized users to see whether the request is from someone who's allowed to receive it.
You don't need to add users to a list of authorized users one-by-one; this demonstration shows how you can use CGI and customized HTML files to allow users to register themselves via Web pages. Use the demonstration to see how Helix Server can integrate with your Web server. Customize the files yourself to match your site's own needs.
Requirements for running the demonstration:
- Commerce Server Edition of Helix Server
- Web Server running on the same host as Helix Server
- Web Server configured to execute CGI programs
Steps to Set Up the Commerce Server PPV Demo
1. Copy sample media files.
2. Copy sample CGI program and configuration file to your Web server.
3. Copy sample HTML pages to your web server.
4. Configure the Real Server Commerce feature.
5. Edit PPVDemo configuration file.
6. Edit sample HTML pages.
7. Browse to welcome.html and start registering.
8. Web Browser Configuration Considerations.
9. Customizing the PPVDemo Source.
10. Debugging.
1. Copy the Sample Media Files
Copy the supplied sample media files to a secure Helix Server directory.
Copy: (Helix Server main directory)/Commerce/media/sample1.rm
(Helix Server main directory)/Commerce/media/sample2.rm
To: (Helix Server main directory)/Secure
Note: PPVDemo can use any media files, as long as they are named "sample1.rm"
or "sample2.rm". If you change the media file name
you will have to modify the secure and permissions.html pages.
2. Copy the Sample CGI Program and Configuration File to Your Web Server
Copy the ppvdemo.exe program and ppvdemo.ini file to an appropriate CGI directory of the your Web server.
Copy: (Helix Server main directory)/Commerce/bin/ppvdemo.exe
(Helix Server main directory)/Commerce/bin/ppvdemo.ini
To: A CGI directory served by your Web server
Example: Copy ppvdemo.ini and ppvdemo.exe into the web servers directory
where CGI scripts are installed.
3. Copy Sample HTML Pages to Your Web Server
Copy all supplied html files to a Web Server document directory.
Copy: (Helix Server main directory)/Commerce/html/permissions.html
(Helix Server main directory)/Commerce/html/register.html
(Helix Server main directory)/Commerce/html/secure.html
(Helix Server main directory)/Commerce/html/welcome.html
(Helix Server main
directory)/Commerce/html/image/rm_.gif
(Helix Server main directory)/Commerce/html/image/rnlogo.gif
To: The document path served by the your Web server
Copy all supplied gif files to an Web Server image directory.
Copy: (Helix Server main
directory)/Commerce/html/image/rm_.gif
(Helix Server main directory)/Commerce/html/image/rnlogo.gif
To: The image directory served by the your Web server
Example: Copy *.html into the c:\inetpub\wwwroot
directory. and
Copy the *.gif into the C:\inetpub\wwwroot\image
directory.
4. Configure the Real Server Commerce feature
Configure the Real Server security context by entering these values into the
Real Server Administrative Interface. Test the Security configuration
directly from the Real Player before trying the PPVDemo.
Define User Database using a Flat File style database
Database Name =PPVDemo
Database Type = Flat File
Database File Name =C:\Program Files\Real\Helix Server\con_r_db
Define Authentication using a PPVDemo realm
Real Description=PPVDemo
Realm ID=(hostname).PPVDemo
Authentication Protocol=Basic
Database=PPVDemo
(Add a user)
Establish Commerce Rules
Rule Name= PPVDemo
ProtectedPath=\secure
Database=PPVDemo
Evaluate Permissions=Yes
Allow Duplicates=Yes
Credential Type= Use User Authentication
Realm=PPVDemo
(Set access Permission)
Real Player URL to test content - http:\\(localhost):8008\ramgen\secure\sample1.rm or
rtsp:\\(localhost)\secure\sample1.rm
5. Edit the PPVDemo Configuration File
The ppvdemo.ini file is a plain text file used by the PPVDemo program. Now that you've copied ppvdemo.ini to your Web server, open it in its new location and edit it with a text editor. On each line that does not begin with a semi-colon (;), substitute the correct values for any that do not match your Helix Server or Web server configuration.
;Configuration File for the PPVDemo CGI Executable
;
; The file contains variables which are read by the ppvdemo CGI executable. To run the
; demo from a Web Server, edit the variables ; according to the comments above each entry.
;
; Note: This file uses ";" characters as comment ; marks at the start of each line.
;
;======================================================
[Urls]
;
; Provide the qualified URL to the permissions.html file
Permissions=http://hostname/path/permissions.html
;
; Provide the qualified URL to the secure.html file
Redirect=http://hostname/path/secure.html
;
; Provide the qualitifed URL to the CGI executable file
Cgi=http://hostname/cgi-bin/ppvdemo.exe
;=======================================================
; This Section is for Player Based Authentication Only
;
; Protocol used by the server to register the Player
Protocol=rtsp
;
; Provide the hostname or IP address of the Helix Server
Server=hostname
;
; Port user by the server for the streaming media protocol
Port=554
;
; Provide the value of the GUIDRegistrationPrefix variable in the Helix Server configuration file
Prefix=register
;
; Enter the file used by the Helix Server to capture PlayerIDs
File=register.rm
;
;=======================================================
; This Section Defines Helix Server Configuration Variables
;
[System]
;
; Provide the absolute path to the Helix Server PPV Plugin
Plugin=C:\Program Files\Real\Helix Server\Plugins\ppvb3260.dll
;
; Provide the absolute path and database name specified in the Helix Server configuration file
Database=C:\Program Files\Real\Helix Server\con_r_db
;
; Provide the AuthenticationRealm used for content in the Helix Server configuration file
Realm=hostname.ppvdemo
;
; Set the Authentication Mode (0= Player Based, 1= User Based)
AuthMode=1
; Set the Debug Mode (0= Debug Off, 1= Debug On)
Debug=1
Sample PPVDemo.ini file for the PPVDemo.
[Urls]
Permissions=http://localhost/permissions.html
Redirect=http://localhost/secure.html
Cgi=http://localhost/scripts/ppvdemo.exe
Protocol=rtsp
Server=localhost
Port=554
Prefix=register
File=register.rm
[System]
Plugin=C:\Program Files\Real\Helix Server\Plugins\ppvb3260.dll
Database=C:\Program Files\Real\Helix Server\con_r_db
Realm=PPVDemo
AuthMode=1
Note: The ppvdemo.exe program accepts two commands: insertuser or grantaccess. Web pages supply the commands, based on what the user typed.
Example of insertuser command:
ppvdemo.exe?command=insertuser&userid=testuser&password=testpassword
Example of grantaccess command:
ppvdemo.exe?command=granataccess&userid=testuser&password=testpassword&url=secure/test.rm&urltype=0&permissiontype=0&permissionlength=0 ppvdemo.exe?command=granataccess&userid=testuser&password=testpassword&url=secure/test.rm&urltype=0&permissiontype=1&permissionlength=12/12/2012:12:00:00 ppvdemo.exe?command=granataccess&userid=testuser&password=testpassword&url=secure/test.rm&urltype=0&permissiontype=2&permissionlength=12
ppvdemo.exe?command=granataccess&userid=testuser&password=testpassword&url=secure/test.rm&urltype=0&permissiontype=2&permissionlength=0
6. Edit Sample HTML Pages
A. In register.html (which you just copied to your Web server), locate the following text:
<form action="http://localhost:80/cgi-bin/ppvdemo.exe" METHOD="GET">
Replace the following text:
http://localhost:80/cgi-bin/ppvdemo.exe
with the URL of the ppvdemo.exe file (which you copied to your Web server
in Step 2) as it resides on your Web server.
B. In permissions.html (which you just copied to your Web server),
find the text:
<form name="pForm" action="http://localhost:80/cgi-bin/ppvdemo.exe" METHOD="GET">
Replace the following text:
http://localhost:80/cgi-bin/ppvdemo.exe
with the URL of the ppvdemo.exe file (which you copied to your Web server in Step 2) as it resides on your Web server.
C. Also in permissions.html, locate the following text:
Make sure the following text in this section matches the name and path of the Secure directory on your Helix Server:
value="secure/sample1.rm"
value="secure/sample2.rm"
D. In secure.html (which you just copied to your Web server), locate the following lines:
<li><A HREF="http://localhost:8080/ramgen/secure/sample1.rm">
Sample #1</A>
<li><A HREF="http://localhost:8080/ramgen/secure/sample2.rm">
Sample #2</A>
If your Helix Server secure directory is not named "secure", replace the word "secure" in the URL with the correct directory name.
7. Browse to welcome.html and start registering!
Start the demonstration by pointing your browser to the welcome.html
page. Click on "Click here to register" and you'll see how you or your
users can self-register.
8. Web Browser Configuration Considerations
The PPVDemo requires read and write access to the local directory.
PPVDemo is a CGI like program and will run as a child process to the Web Server. The Web Server will need sufficient access rights to access the Real Server Authentication Database.
9. Customizing the PPVDemo Source
The PPVDemo program is a standalone application that can be executed from either the command prompt or as a CGI program called by your Web browser. The PPVDemo executable can be built from the following files:
| Source Code | ppvdemo.cpp
ppvini.cpp ppvtime.cpp |
| Header Files | ppvdemo.h
ppvini.h ppvtime.h |
| RMA SDK Header files | pncom.h
pnresults.h pntypes.h rmaplugn.h os.h (Win32 only) |
| CGIHTML - http://www.eekim.com Version 1.69 | cgi-lib.c cgi-llist.c html-lib.c string-lib.c cgi-lib.h cgi-llist.h html-lib.h string-lib.h |
| Authentication Access routines | ppvmd5c.c
ppvmd5chl.c ppvmd5.h |
| Building PPVdemo
|
Preprocessor Definitions:
WIN32,_WIN32,_M_IX386,_LITTLE_ENDIAN, _WINDOWS,STRICT,_DEBUG,DEBUG,_CONSOLE,_MBCS |
Building the PPVDemo executable
Win32 - Make a MVC project and include the above list of
source files.
Include the Preprocessor Definitions and compile into a executable.
Unix - Construct a makefile that compiles the above list of source files into an executable.
10: Debugging
Edit the PPVDemo.ini and set debug=1. This will instruct PPVDemo to create in the local directory a file named PPVDEMO.dmp. The Debug option is helpful when you need to debug the PPVDEMO application in an environment when running as a child process of the Web Server. If you set the debug=1 option on and you still do not receive a PPVDEMO.DMP file, then you can assume that the Web Sever is running PPVDEMO with insufficient access right. PPVDemo.exe does not have access rights to write to the local disk.
The PPVDemo debug sample provides clues to where a possible invalid configuration can occur.
===PPVDemo====()
Debug=(1)
szDatabase=(C:\Program Files\Real\Helix Server\con_r_db)
szPluginName=(C:\Program Files\Real\Helix Server\Plugins\ppvb3260.dll)
Plugin instance found=()
Interface IID_IRMAPPVDatabase found=()
DataBase Opened=()
szCommand=(insertuser)
===Insert User====()
szUserid=(PPVDemo)
szPasswrd=(password)
szRealm=(PPVDemo)
szAuthMode=(1)
szPermissionsUrl=(http://localhostl/permissions.html)
MD5Data=(PPVDemo:PPVDemo:password)
authKey=(e50cfc58340386d2de2c0740b041bf6c)
Cleanup=()
PPVDemo includes a third part source CGIHTML. This product has an interactive feature. Once you have installed the PPVDEMO application and have configured the PPVDEMO.ini file you can execute PPVDEMO.exe from the command. line and PPVDEMO.exe will prompt you for a HTTP statement. You can enter it directly into the console and PPVDEMO.exe will go to work on your submitted HTTP statement.
PPVDemo interactive Mode sample:
C:\Inetpub\Scripts>ppvdemo
--- cgihtml Interactive Mode ---
Enter CGI input string. Remember to
Press ENTER when done:
http:\\localhost:8080\scripts\ppvdemo.exe?command=insertuser&userid=testuser&password=testpassword