Note that there are some explanatory texts on larger screens.

plurals
  1. POaws cloudfront Private streaming setup using and expirable links generation using Java
    text
    copied!<p>I am trying to setup secure streaming with amazon s3 and cloudfront. I have done the following steps and I always get an error saying </p> <blockquote> <p>"stream not found".</p> </blockquote> <ol> <li>Setup s3 bucket and uploaded mp3 file(file.mp3) for testing.</li> <li>Created origin access policy in cloudfront, got Id and S3 canonicle Used Id.</li> <li>Given S3 canonicle User Id read permissions to s3 bucket. (For testing I have given read permission to everyone as well.)</li> <li>Created RSA public/private key for cloudfront.</li> <li>Created Streaming distribution in cloudfront with previous s3 bucket as origin and Trusted Signer as self. Result of this request shows self trusted signer with public key Id.</li> <li>Generated signed url using private key.</li> <li>Created html file to show this mp3 using jwplayer.</li> </ol> <p>Below is the code I used to create origin signed url</p> <pre><code> Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider()); String distributionDomain = "sbngg4fbfkiq2.cloudfront.net"; String privateKeyFilePath = "src/s3access/pk-APKAJRHSQBGT5CW7P2CA.der"; String s3ObjectKey = "file.mp3"; // Convert your DER file into a byte array. byte[] derPrivateKey = ServiceUtils.readInputStreamToBytes(new FileInputStream(privateKeyFilePath)); String signedUrlCanned = CloudFrontService.signUrlCanned( s3ObjectKey, // Resource URL or Path "APKAJRHSQBGT5CW7P2CA.", // Certificate identifier, // an active trusted signer for the distribution derPrivateKey, // DER Private key data new Date(112,3,29) // DateLessThan ); System.out.println(signedUrlCanned); </code></pre> <p>This gives signed url. Then I have used following html file.</p> <pre><code>&lt;html&gt;&lt;head&gt; &lt;script type='text/javascript' src='jwplayer.js'&gt;&lt;/script&gt; &lt;/head&gt;&lt;body&gt; &lt;div id="container"&gt;Loading the player ...&lt;/div&gt; &lt;script type="text/javascript"&gt; jwplayer('container').setup({ 'id': 'playerID', 'width': '352', 'height': '240', 'provider': 'rtmp', 'streamer': 'rtmp://sbngg4fbfkiq2.cloudfront.net/cfx/st', 'file': 'file.mp3?Expires=1335637800&amp;Signature=asSUSIbGYZP9IXnmjWIKgXMP2DCCA1B-x0mQtsQbUBFWdbKzlU~NnId8VH8T5ww8I1nbZKHWoLpGr679~QoDSMScKpVxVbyYVjQ0kn-JejzSkM6~ZEC6r8nArEdrT9R-M6EjR~IBkuPD-0qW2OUk1MBC4oiNeytIolG6IrSTGOU_&amp;Key-Pair-Id=APKAJRHSQBGT5CW7P2CA', 'modes': [ { type: 'flash', src: 'player.swf' } ] }); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>It displays video frame. Clicking on play button tried to load stream but after couple of seconds it says</p> <pre><code> Stream not foundfile.mp3?Expires=1335637800&amp;Signature=asSUSIbGYZP9IXnmjWIKgXMP2DCCA1B-x0mQtsQbUBFWdbKzlU~NnId8VH8T5ww8I1nbZKHWoLpGr679~QoDSMScKpVxVbyYVjQ0kn-JejzSkM6~ZEC6r8nArEdrT9R-M6EjR~IBkuPD-0qW2OUk1MBC4oiNeytIolG6IrSTGOU_&amp;Key-Pair-Id=APKAJRHSQBGT5CW7P2CA </code></pre> <p>Please help me to setup this. Let me know if I am missing something.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload