Created
January 8, 2013 16:43
-
-
Save josmera01/4485346 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require('OoyalaApi.php'); | |
$apiKey = "E1MWo6Boqq_S9PrsnZteUoe2X4qK.Zi4rW"; | |
$apiSecret = "MSm5wS9oDVsnnIoaQAt5FNtvlNCiQ1wMMEOQ2iyA"; | |
$api = new OoyalaAPI($apiKey, $apiSecret); | |
$embedCode = "8zbmU3MzrntQbczRcikkAz4UFFQ6hAg8"; | |
$pcode = "E1MWo6Boqq_S9PrsnZteUoe2X4qK"; | |
$path = "player/embed_token/$pcode/$embedCode"; | |
$expires = time() + 60000; | |
$params = Array("api_key" => $apiKey, "expires" => $expires); | |
$signature = $api->generateSignature("GET", $path, $params); | |
$embed_token = "http://player.ooyala.com$path?api_key=$apiKey&expires=$expires&signature=$signature"; | |
?> | |
<html> | |
<head> | |
<title>Secure Playback Token Demo</title> | |
</head> | |
<body> | |
<script src="http://player.ooyala.com/player.js?embedCode=<?php echo $embedCode;?>&height=720&videoPcode=E1MWo6Boqq_S9PrsnZteUoe2X4qK&width=1280&hasModuleParams=1&callback=playerCallback"></script> | |
<script type="text/javascript"> | |
function playerCallback(playerId, eventName, eventArgs){ | |
if(eventName == "playerEmbedded"){ | |
document.getElementById(playerId).setModuleParams({ "authorization" : { "embed_token" : "<?php echo $embed_token; ?>" } }); | |
} | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment