Hosting and Streaming Your Own Videos Securely Using Amazon's Simple Storage Service (S3)
The Web Page
This is the code; you can open the walk-through in another window to compare them side-by-side.
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2 "http://www.w3.org/TR/xhtml4/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
4 <head>
5 <title>The Title of Your Page Should Be Meaningful to Search Engines & Humans Both</title>
6 <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
7 <meta name="description" content="Of course, so should your meta description . . ." />
8 <meta name="keywords" content=" . . . and your keywords." />
9 <meta name="author" content="Joel D Canfield, Spinhead Web Design" />
11 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
12 <meta http-equiv="imagetoolbar" content="no" />
13 <link rel="stylesheet" type="text/css" href="yourstylesheet.css" />
14 <link rel="shortcut icon" href="favicon.ico" />
15 </head>
16 <body>
17 <?php
18 define("AWS_S3_KEY", "put your real S3 public key here");
19 define("AWS_S3_SECRET", "put your real S3 secret key here");
20 $expires = time()+60*60;
21 $bucket = "mybucket";
22 $resource = "video.flv";
23 $string_to_sign = "GET\n\n\n{$expires}\n/{$bucket}/{$resource}";
24 $signature = urlencode(base64_encode(hash_hmac("sha1", utf8_encode($string_to_sign), AWS_S3_SECRET, TRUE)));
24a $string_to_sign),
24b utf8_encode(
24c "sha1",
24d AWS_S3_SECRET,
24e TRUE
24f hash_hmac(
24g )
24h base64_encode(
24i )
24j urlencode(
24k )
24l ;
25 $authentication_params = "AWSAccessKeyId=".AWS_S3_KEY;
26 $authentication_params.= "&Expires={$expires}";
27 $authentication_params.= "&Signature={$signature}";
28 $link = "https://{$bucket}.s3.amazonaws.com/{$resource}?{$authentication_params}";
29 ?>
30
31 <script type="text/javascript" src="flowplayer-3.1.4.min.js"></script>
32
33 <?php
34 echo "<a href=\"".urlencode($link)."\" id=\"player\"></a>";
35 ?>
36 <script type="text/javascript">
37 flowplayer("player", "flowplayer-3.1.3.swf",
38 {
39 clip:
40 {
41 autoPlay: false,
42 autoBuffering: true
43 }
44 });
45 </script>
46
47 </body>
48 </html>