mainmanc: that seems like an interesting approach. Our billing system could easily interact with a remote host/system such as the Roku, but it's still not clear for us how the DVP itself would authenticate the client, unless using standard username/password scheme (vs. rendezvous with on-screen token).
Since RokuKevin mentioned it, we are using different S3 PHP tools to automatically generate signed URLs that expire after a defined time or after a defined number of clicks. CloudFront is used as the CDN that actually connects to S3 where the videos are stored.
For instance (requires importing hmac.php):
require_once('hmac.php');
/*
* sign the URL, given original URL and secret key
*/
function signUrl($unsignedUrl, $secretKey){
$parsedUrl = parse_url($unsignedUrl);
parse_str($parsedUrl["query"],$output);
ksort($output,SORT_STRING);
$first = true;
$sortedQuery="";
foreach ($output as $key => $value) {
if ($first) {
$first = false;
} else {
$sortedQuery .= "&";
}
$hmac_data .= $key . $value;
$sortedQuery .= $key . "=" . urlencode($value);
}
$strToSign = $parsedUrl["path"]."?".$sortedQuery;
//echo "<br> StrToSign: ".$strToSign;
error_log("wine: str to sign = ".$strToSign."\n", 3, "c:/php.out");
//get HMAC signature
$hmac = new Crypt_HMAC($secretKey,"sha1");
$hmac_digest = $hmac->hash(trim($strToSign));
$binary_hmac = pack("H40",$hmac_digest);
$base64_hmac = base64_encode($binary_hmac);
return $unsignedUrl."&awsSignature=".urlencode($base64_hmac);
}
This allows to create expiring links inside each user private section, that they can easily access after logging-in. The process is as follows:
* User purchases a video/movie and pays for it through our distribution channel
* Payment is reported to our database and user gets authorization for x number of videos/movies
* User logs in to his private section (that's how we identify it), browses the entire catalog, and when he selects a video/movie, the system generates a 24hr expiring link to that movie, associated with his ID, and places that link into a private folder
* The user's STB retrieves that link by using authenticated "wget" from our servers, and associates the link with a variable that is later used by the MPEG4 internal player as target file
Does anyone have any suggestion about how a similar procedure could be coded for Roku DVP? Is there a way to first authenticate the user, then make Roku download an expiring link, and associate that link to a variable that can be later user as the simpleVideoplayer target mp4 file?
Thank you.