API
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:
https://teez-media.com/teezlink/getMyVideo.php?uid=[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.phpsession_start(); $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 unset($_SESSION[$videoFile.'_uniqueId']); // This will create the uniqueId for you (And checks if it has not been set yet. if (isset($_SESSION[$videoFile.'_uniqueId'])) { $uniqueId=$_SESSION[$videoFile.'_uniqueId']; } else { $uniqueId=uniqid(true); $_SESSION[$videoFile.'_uniqueId']=$uniqueId; } $API_code='YOUR_API_CODE'; $encodeText='Licensed to testuser for personal use only'; $myvars = 'API_code='.$API_code.'&encodeText='.$encodeText.'&videoFile='.$videoFile.'&uniqueId='.$uniqueId; $url = 'https://teez-media.com/teezlink/processVideo.php'; $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 ); header('Location: https://teez-media.com/teezlink/getMyVideo.php?uid='.$uniqueId);
The code indicated in red will need to be changed by you. For your videoFile parameter, you could chance this into:
$videoFile=$_GET['filename'];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:
https://yoursite.com/teezlink.php?filename=testvideo.mp4 - (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.