Media protection





The API will allow you to integrate your website to use our content protection system. It's works as follows:
You call a page on our server while sending the following POST data:
- API_code = the code that will be provided to you to identify yourself
- encodeText = the text you want us to watermark into the video
- videoFile = the video file requested by your customer
- uniqueId = the ID with which your customer is interacting

Once this data is sent, our servers will start encoding the selected video with the selected watermark for you. You can then redirect your customer to our waiting line by providing the uniqueId at the address:[uniqueId]
(Replace [uniqueId] by the uniqueId provided from your system)

PHP Example

You can name the file by any name you want, but for this example, we will call the file: teezlink.php
                            $videoFile= 'testvideo.mp4';

                            //This page should only be called once. The user will be redirected upon success. 
                            //Therefore the session and process will be reset when the user accesses this page again
                            //in case something went wrong


                            // This will create the uniqueId for you (And checks if it has not been set yet.
                            if (isset($_SESSION[$videoFile.'_uniqueId']))

                            $encodeText='Licensed to testuser for personal use only';
                            $myvars = 'API_code='.$API_code.'&encodeText='.$encodeText.'&videoFile='.$videoFile.'&uniqueId='.$uniqueId;
                            $url = '';
                            $ch = curl_init( $url );
                            curl_setopt( $ch, CURLOPT_POST, 1);
                            curl_setopt( $ch, CURLOPT_POSTFIELDS, $myvars);
                            curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1);
                            curl_setopt( $ch, CURLOPT_HEADER, 0);
                            curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);

                            $response = curl_exec( $ch );   

The code indicated in red will need to be changed by you. For your videoFile parameter, you could chance this into:

and if your username is in your session or cookie, you could change the encodeText parameter into:
$encodeText="Licensed to ".$_SESSION['username']." for personal use only";
It's easy as pie from now. All you need to do is make a link on your website for each video, linking to: - (best to open in a new tab)
The user will be redirected to our servers where his video will be prepared. Once prepared, the video will start streaming immediately, and he will have an option to download the video as well.

Naturally, you will need to provide your own code to prevent your other users from allowing access to this file. You can put an 'if' statement around the entire block (would probably be easier to leave 'session_start()' out though) and check if user is logged in, and has access. If not: redirect him to your homepage or show an error or something.