Welcome Guest Search | Active Topics | Members | Log In | Register

Yet another private RTMP streaming challenged developer Options
csdsubscriber
Posted: Sunday, July 25, 2010 5:15:52 AM
Rank: Member
Groups: Member

Joined: 7/25/2010
Posts: 10
Points: 30
Location: Canada
Hi there,

Seems this one is an endless struggle for the developer community, based on all the posts I've reviewed online.

I've spent hours and hours trying to find the right combination to allow CloudFront streaming of private video content. I've streamed using RTMP fine when everything was set to public, so I know there has to be some combination I'm missing on the private security side of things. There sure doesn't seem to be any clear step-by-steps on this thing out there.

Before assessing whether I'm correctly generating a signed URL at the code level where I'm ultimately headed, I thought I should be able to simply set up and Object/Embed tag set for JWPlayer in a normal .htm file, based on the URL Cloudberry generates.

But even this gives me the "Stream Not Found" error.

To prepare for the above test, I generated the public/private key pair in the AWS console. I enabled private distribution and streaming on the bucket. I set the canned policy on the bucket using the Generate Web Url dialog for this resource. Then I generated the URL with the RTMP radio button checked in the Generate Web Url dialog.

Here is a sample URL CloudBerry generated for my private resource:

rtmp://s31u8b7i0j4yv.cloudfront.net/cfx/st/video.flv?Expires=1280610244&Signature=S3XtxPuUAZWcEXoWgje3yqYdTVqbpmP5tgHibvmk9pq-zGQ14IW1KLmZWYt52p2VGrEdqeqxAVuunjqMAzwQzOsWM7DXhczB8MuYNSjv-N9LddAFAzJ3svdPrFR8u-f5kc0Gshpoj7jTwhycqx3C92-6x4oll3UR3X9UJg2q6FQ_&Key-Pair-Id=APKAJKYXG5KUS3QWZPBA

Based on this, I created this Object/Embed tag set:

<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' width='400'height='429'>
<param name='movie' value='http://tk9977.websitetoolkit.ca.s3.amazonaws.com/player.swf'>
<param name='allowfullscreen' value='true'> <param name='allowscriptaccess' value='always'>
<param name='wmode' value='transparent'>
<param name='flashvars' value='file=video.flv?Expires=1280610244&Signature=S3XtxPuUAZWcEXoWgje3yqYdTVqbpmP5tgHibvmk9pq-zGQ14IW1KLmZWYt52p2VGrEdqeqxAVuunjqMAzwQzOsWM7DXhczB8MuYNSjv-N9LddAFAzJ3svdPrFR8u-f5kc0Gshpoj7jTwhycqx3C92-6x4oll3UR3X9UJg2q6FQ_&Key-Pair-Id=APKAJKYXG5KUS3QWZPBA&streamer=rtmp://s31u8b7i0j4yv.cloudfront.net/cfx/st&provider=rtmp'>
<embed src='http://tk9977.websitetoolkit.ca.s3.amazonaws.com/player.swf' width='400' height='429' bgcolor='#ffffff'
allowscriptaccess='always' allowfullscreen='true'
flashvars='file=video.flv?Expires=1280610244&Signature=S3XtxPuUAZWcEXoWgje3yqYdTVqbpmP5tgHibvmk9pq-zGQ14IW1KLmZWYt52p2VGrEdqeqxAVuunjqMAzwQzOsWM7DXhczB8MuYNSjv-N9LddAFAzJ3svdPrFR8u-f5kc0Gshpoj7jTwhycqx3C92-6x4oll3UR3X9UJg2q6FQ_&Key-Pair-Id=APKAJKYXG5KUS3QWZPBA&streamer=rtmp://s31u8b7i0j4yv.cloudfront.net/cfx/st&provider=rtmp' />
</object>

The JWPlayer shows but when I click to run the file, I get the "Stream Not Found" error.

I've tried with and without the closing forward slash at the end of the streamer parameter, since I've seen it shown both ways in different posts. This made no difference.

Anything obvious I'm doing wrong?

Thanks.

Kel
IP
Posted: Monday, July 26, 2010 4:57:16 PM

Rank: Administration
Groups: Administration , Member, Moderator

Joined: 2/17/2009
Posts: 88
Points: 206
Hi there!

If you are using URL as a part of query string (like in flashvars) you have URL-encode special characters used to separate query parameters :
? --> %3f
& --> %26
= --> %3d

In CloudBerry Explorer I'd recommend you using HTML web URL instead of RTMP , the template can be configured for your needs, and the URL-encoding is made automatically

Sincerely,
IP



CloudBerry Lab
csdsubscriber
Posted: Wednesday, July 28, 2010 7:13:51 AM
Rank: Member
Groups: Member

Joined: 7/25/2010
Posts: 10
Points: 30
Location: Canada
I did a search and replace on the special characters, but when I ran the page I just saw the striped status bar "spinning" in the middle of where the video should be showing. In other words the video player's window didn't even fully form this time.

I'm not clear what you meant by using "HTML web URL instead of RTMP". We're wanting to stream private media so it does not leave a .flv file in the browser cache. My understanding is this required RTMP. Is that not correct?

Thanks for any further thoughts you can offer.

Kel

IP wrote:
Hi there!

If you are using URL as a part of query string (like in flashvars) you have URL-encode special characters used to separate query parameters :
? --> %3f
& --> %26
= --> %3d

In CloudBerry Explorer I'd recommend you using HTML web URL instead of RTMP , the template can be configured for your needs, and the URL-encoding is made automatically

Sincerely,
IP

IP
Posted: Wednesday, July 28, 2010 5:53:54 PM

Rank: Administration
Groups: Administration , Member, Moderator

Joined: 2/17/2009
Posts: 88
Points: 206
Hi Kel!

Depending on the version of JWPlayer you use (I mean player.swf) you may need to remove ".flv" at the end of the filename to get it working for signed URLs (in case of simple URL .flv extension is automatically removed by player, but in case of signed URL old version cannot find this extension at the end, because of a query string after a file name.

If you are using CloudBerry Explorer to generate signed private content streaming URLs, there's a radio-button HTML right after RTMP.

You can specify your HTML template and use special sequences: {0} and {1} in it, that will be substituted by FLV relative file path and RTMP streamer. There's a predefined default template for JWPlayer

Note, that you still have to remove .flv in the end of the filename, or upgrade your jwplayer to a newer version.

Sincerely,
PI





CloudBerry Lab
csdsubscriber
Posted: Thursday, July 29, 2010 12:06:54 AM
Rank: Member
Groups: Member

Joined: 7/25/2010
Posts: 10
Points: 30
Location: Canada
I've tried removing the .flv on the flashvars segements, but it still just sits there spinning without the player window completely forming itself.

Here is the latest version of what I'm using:

<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' width='400'height='429'>
<param name='movie' value='http://tk9977.websitetoolkit.ca.s3.amazonaws.com/player.swf'>
<param name='allowfullscreen' value='true'> <param name='allowscriptaccess' value='always'>
<param name='wmode' value='transparent'>
<param name='flashvars' value='file=video%3fExpires=1280610244%26Signature=S3XtxPuUAZWcEXoWgje3yqYdTVqbpmP5tgHibvmk9pq-zGQ14IW1KLmZWYt52p2VGrEdqeqxAVuunjqMAzwQzOsWM7DXhczB8MuYNSjv-N9LddAFAzJ3svdPrFR8u-f5kc0Gshpoj7jTwhycqx3C92-6x4oll3UR3X9UJg2q6FQ_%26Key-Pair-Id=APKAJKYXG5KUS3QWZPBA%26streamer=rtmp://s31u8b7i0j4yv.cloudfront.net/cfx/st%26provider=rtmp'>
<embed src='http://tk9977.websitetoolkit.ca.s3.amazonaws.com/player.swf' width='400' height='429' bgcolor='#ffffff'
allowscriptaccess='always' allowfullscreen='true'
flashvars='file=video%3fExpires=1280610244%26Signature=S3XtxPuUAZWcEXoWgje3yqYdTVqbpmP5tgHibvmk9pq-zGQ14IW1KLmZWYt52p2VGrEdqeqxAVuunjqMAzwQzOsWM7DXhczB8MuYNSjv-N9LddAFAzJ3svdPrFR8u-f5kc0Gshpoj7jTwhycqx3C92-6x4oll3UR3X9UJg2q6FQ_%26Key-Pair-Id=APKAJKYXG5KUS3QWZPBA%26streamer=rtmp://s31u8b7i0j4yv.cloudfront.net/cfx/st%26provider=rtmp' />
</object>

Any other thoughts?

BTW, why does the CloudBerry code only provide the embed tag, and not the wrapping object tag?

Kel
csdsubscriber
Posted: Thursday, July 29, 2010 12:24:06 AM
Rank: Member
Groups: Member

Joined: 7/25/2010
Posts: 10
Points: 30
Location: Canada
Alright, I went to the HTML radio button in CloudBerry and grabbed the latest embed code from there. Based on that I built the object tag wrapper around it. (Again, why isn't that automatically done?)

With this code the player window creates properly again, but when I click the run icon it still says "Stream not found:...". I've tried removing both .flv extensions too, but with the same result.

So it now looks like so with the extensions included:

<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' width='470'height='290'>
<param name='movie' value='http://tk9977.websitetoolkit.ca.s3.amazonaws.com/player.swf'>
<param name='allowfullscreen' value='true'> <param name='allowscriptaccess' value='always'>
<param name='wmode' value='transparent'>
<param name='flashvars' value='file=video.flv%3FAWSAccessKeyId%3DAKIAJGCH4CKV7GXZ4TAQ%26Expires%3D1280941783%26Signature%3D1N2FdkJd4%2fu3fCKL6ruvetBg1ss%3d&streamer=rtmp://s31u8b7i0j4yv.cloudfront.net/cfx/st/'>

<embed
src='http://tk9977.websitetoolkit.ca.s3.amazonaws.com/player.swf'
width='470'
height='290'
bgcolor='#ffffff'
allowscriptaccess='always'
allowfullscreen='true'
flashvars='file=video.flv%3FAWSAccessKeyId%3DAKIAJGCH4CKV7GXZ4TAQ%26Expires%3D1280941783%26Signature%3D1N2FdkJd4%2fu3fCKL6ruvetBg1ss%3d&streamer=rtmp://s31u8b7i0j4yv.cloudfront.net/cfx/st/'
/>
</object>

It looks like so the extensionse excluded:

<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' width='470'height='290'>
<param name='movie' value='http://tk9977.websitetoolkit.ca.s3.amazonaws.com/player.swf'>
<param name='allowfullscreen' value='true'> <param name='allowscriptaccess' value='always'>
<param name='wmode' value='transparent'>
<param name='flashvars' value='file=video%3FAWSAccessKeyId%3DAKIAJGCH4CKV7GXZ4TAQ%26Expires%3D1280941783%26Signature%3D1N2FdkJd4%2fu3fCKL6ruvetBg1ss%3d&streamer=rtmp://s31u8b7i0j4yv.cloudfront.net/cfx/st/'>

<embed
src='http://tk9977.websitetoolkit.ca.s3.amazonaws.com/player.swf'
width='470'
height='290'
bgcolor='#ffffff'
allowscriptaccess='always'
allowfullscreen='true'
flashvars='file=video%3FAWSAccessKeyId%3DAKIAJGCH4CKV7GXZ4TAQ%26Expires%3D1280941783%26Signature%3D1N2FdkJd4%2fu3fCKL6ruvetBg1ss%3d&streamer=rtmp://s31u8b7i0j4yv.cloudfront.net/cfx/st/'
/>
</object>

Any further suggestions?

Thanks.

Kel
IP
Posted: Friday, July 30, 2010 4:51:48 AM

Rank: Administration
Groups: Administration , Member, Moderator

Joined: 2/17/2009
Posts: 88
Points: 206
Hi Kel!

You shouldn't encode ALL occurrences of these symbols

the flashvars parameter is a sequernce of key-value pairs separated by '&' sign:
'file=<FilePath>&streamer=<StreamerValue>&provider=<ProvideValue>'

But if one of the parameters includes & (or ?,=) it must be incoded. In our case <FilePath> contains special characters, so they must be encoded,
but not the characters that delimits flashvars parameters one from each other.

Your fixed HTML looks like here (and it works for me in IE, FF and Chrome)
Code:

<embed
  src='http://tk9977.websitetoolkit.ca.s3.amazonaws.com/player.swf'
  width='470'
  height='290'
  bgcolor='#ffffff'
  allowscriptaccess='always'
  allowfullscreen='true'
  flashvars='file=video%3fExpires=1280610244%26Signature=S3XtxPuUAZWcEXoWgje3yqYdTVqbpmP5tgHibvmk9pq-zGQ14IW1KLmZWYt52p2VGrEdqeqxAVuunjqMAzwQzOsWM7DXhczB8MuYNSjv-N9LddAFAzJ3svdPrFR8u-f5kc0Gshpoj7jTwhycqx3C92-6x4oll3UR3X9UJg2q6FQ_%26Key-Pair-Id=APKAJKYXG5KUS3QWZPBA&streamer=rtmp://s31u8b7i0j4yv.cloudfront.net/cfx/st&provider=rtmp'
/>


Note that separating '&' signs are not encoeded (the same for '=')

In your last post I see that the generated URLs are not private content URLS. because they does not contain Key-Pair-Id parameter, but contain AWSAccessKeyId parameter that is used for normal HTTP distribution. Did you select the Policy on that screen?

You can modify and save the template having the object tag wrapped around embed. It will look like
Code:

<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' width='400'height='429'>
<param name='movie' value='http://tk9977.websitetoolkit.ca.s3.amazonaws.com/player.swf'>
<param name='allowfullscreen' value='true'> <param name='allowscriptaccess' value='always'>
<param name='wmode' value='transparent'>
<param name='flashvars' value='file={0}&streamer=rtmp://{1}/&provider=rtmp'>
<embed src='http://tk9977.websitetoolkit.ca.s3.amazonaws.com/player.swf' width='400' height='429' bgcolor='#ffffff'
allowscriptaccess='always' allowfullscreen='true'
flashvars='file={0}&streamer=rtmp://{1}/&provider=rtmp' />
</object>

Note the {0} and {1} are used twice (in <object> and in <embed> tags)
Our default template is minimal and simple so that it help new users to understand how it works.



CloudBerry Lab
csdsubscriber
Posted: Friday, July 30, 2010 10:16:40 PM
Rank: Member
Groups: Member

Joined: 7/25/2010
Posts: 10
Points: 30
Location: Canada
Thank you for the further clarification on only URL encoding the flashvars parameter contents, and not the whole flashvars. That was indeed what was missing. And yes, I had generated my list example without specifying the policy.

Thank you too for the expanded template. That was helpful.

I do find this entire process needs to be more clearly documented with a step by step somewhere. All the CloudBerry posts are in bits and pieces, apparently so as not to have to "rewrite" parts that had already been described. But I think it would be helpful to step by step the overall setup, with just private video streaming in mind.

Just a thought...

Now my last step is to get this all generating programmatically! Not your direct area, I know.

But thanks so much for getting me to something I can look at that actually works. Now I can use that to get to the code I need.

Kel
csdsubscriber
Posted: Saturday, July 31, 2010 1:10:08 AM
Rank: Member
Groups: Member

Joined: 7/25/2010
Posts: 10
Points: 30
Location: Canada
Another question related to this thread's subject matter.

You pointed out that for one of my examples above I had not associated a policy, with the result being the URL was not a private streaming URL, lacking the Key-Pair-Id parameter, and having the AWSAccessKeyId instead.

My question is, is there ever a case using CloudFront, where you would have this scenario of using RTMP without key pair in the picture?

I notice when I have the distribution set to private, but not the streaming, Cloudberry Explorer suggests a URL that uses the AWSAccessKeyId and a signature that assumably uses that.

Would I ever actually want this? Perhaps it would be helpful to understand the permutations and combinations of private distributions versus streaming scenarios, if they exist.

Thanks.

Kel
IP
Posted: Tuesday, August 03, 2010 7:06:06 PM

Rank: Administration
Groups: Administration , Member, Moderator

Joined: 2/17/2009
Posts: 88
Points: 206
Hi Kel!

The private streaming distribution URLS should always have the link with Key-Pair-Id (also Signature and Policy)
If you do not have private content option on your STREAMING distribution, there should be no way to generate expired URLS for your streaming content. Note that when RTMP or HTML is selected, the CNAME field contains only streaming distribution name (and it's CNAMES)

When you select HTTP or HTTPS, the CNAME contains wither the origin name (bucket name path) or distribution name and it's CNAMEs.

The AWSAccessKeyId parameter is only used in signed URLs for HTTP content and if there's no private distribution configured for it. You should also note that the correct CNAME should be selected when you generate WebURL for distribution.

Sincerely,
IP

CloudBerry Lab
Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Main Forum RSS : RSS

CloudBerry theme Created by me (Alex)
Powered by Yet Another Forum.net version 1.9.1.8 (NET v2.0) - 3/29/2008
Copyright © 2003-2008 Yet Another Forum.net. All rights reserved.
This page was generated in 0.373 seconds.