How to run a Private Content Video from Cloudfront

2019-03-31 10:37发布

Steps to reproduce:

  1. set up S3 bucket
  2. set up streaming disrtibution
  3. generate cloudfront key pair
  4. download .PEM file with RSA Private key
  5. generate XML from RSA key using http://www.jensign.com/opensslkey/opensslkey.cs
  6. upload file "testUnsecure.flv", set ACL properties so that everyone can view it.
  7. Set up a webpage with following java script:

    var p = flowplayer("rtmpPlayer", { src: "flowplayer-3.1.5.swf", height: "480px" }, { plugins: { rtmp: { url: 'flowplayer.rtmp-3.1.3.swf', netConnectionUrl: 'rtmp://s3py83uop6xa8x.cloudfront.net/cfx/st', objectEncoding: '0' } }, clip: { autoPlay: false, url: 'flv:testUnsecure' , provider: 'rtmp' } });

  8. This works!

Then did this:

  1. Upload testSecure.flv, set ACL to make it private
  2. Generate Signed URL and build the string. url in the javascript looks like this:

url:'flv:testSecure%3fExpires%3d1277469187%26Signature%3dE5OleaO26fwLi6jIKTa4inc8I4P86AgTg5x8SmleTSTyf5C5AfnQyqaFXLDjiF0kiqdplhauA8Kw%7eS37EpRBAn-aJrJScVlw7aZ-SAL24MTLMZ9foSkCd2ai9KjS8AuuweJRwPWmf4eLDpI4X4f3k3H7UUVcq8SX92ed5fCB91w_%26Key-Pair-Id%3dAPKAJUIBASIKTLFDSDFA'

This fails. The video just hangs there....

Does anyone know how to

  1. Generate a signed URL for a private video using C#?
  2. Play the video in either Flowplayer or JWPLayer (i'll use whichever one I can get it to work with!)

A few more points -- I use code identical to this to generate the Signed URL: http://beckelman.net/post/2010/03/30/Policy-Signing-in-C-for-Streaming-Private-Content-From-Amazon-CloudFront.aspx

I will buy a round of drinks for everyone who lives within 100 miles of me if you guys can solve this.

1条回答
我只想做你的唯一
2楼-- · 2019-03-31 11:26

Right - just in case anyone stumbles across this and has the same problem, this is what I did to fix it:

  1. Create a cloud origin access identity (I did this through C# but could have done it with cloudberry)
  2. Download cloudberry for S3 - the community edition
  3. Find the FLV file on the distribution in cloudberry (i.e. the streaming distribution), right click, and in the properties make sure that the origin access identity has Read access -- this was the key bit.

Otherwise the above code was actually correct.

查看更多
登录 后发表回答