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
"stream not found".
Below is the code I used to create origin signed url
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);
This gives signed url. Then I have used following html file.
<html><head>
<script type='text/javascript' src='jwplayer.js'></script>
</head><body>
<div id="container">Loading the player ...</div>
<script type="text/javascript">
jwplayer('container').setup({
'id': 'playerID',
'width': '352',
'height': '240',
'provider': 'rtmp',
'streamer': 'rtmp://sbngg4fbfkiq2.cloudfront.net/cfx/st',
'file':
'file.mp3?Expires=1335637800&Signature=asSUSIbGYZP9IXnmjWIKgXMP2DCCA1B-x0mQtsQbUBFWdbKzlU~NnId8VH8T5ww8I1nbZKHWoLpGr679~QoDSMScKpVxVbyYVjQ0kn-JejzSkM6~ZEC6r8nArEdrT9R-M6EjR~IBkuPD-0qW2OUk1MBC4oiNeytIolG6IrSTGOU_&Key-Pair-Id=APKAJRHSQBGT5CW7P2CA',
'modes': [
{
type: 'flash', src: 'player.swf'
}
]
});
</script>
</body>
</html>
It displays video frame. Clicking on play button tried to load stream but after couple of seconds it says
Stream not foundfile.mp3?Expires=1335637800&Signature=asSUSIbGYZP9IXnmjWIKgXMP2DCCA1B-x0mQtsQbUBFWdbKzlU~NnId8VH8T5ww8I1nbZKHWoLpGr679~QoDSMScKpVxVbyYVjQ0kn-JejzSkM6~ZEC6r8nArEdrT9R-M6EjR~IBkuPD-0qW2OUk1MBC4oiNeytIolG6IrSTGOU_&Key-Pair-Id=APKAJRHSQBGT5CW7P2CA
Please help me to setup this. Let me know if I am missing something.
I got it working with same setup I mentioned above, but few cases