Amazon CloudFront recently began a service which gives the ability to deliver content in a private fashion. The resulting URI gets very long due to the private key that is delivered to access the content. JWPlayer does not seem to handle the exta long URI.
I checked out the other threads related to long URIs but most of them seemed to be concerned with the + sign encoding conversion. The private key does not contain any + signs but still will not play the underlying video.
I recieve the video name from a stored cookie and couple it with the privacy signature. I have confirmed that the video will play correctly without including the privacy code. I have also confirmed that a single document will serve correctly from Amazon using the privacy code if JWPlayer is not used (ie simple private file access). So it has to be the extra long privacy content.
Any suggestions???
<script type='text/javascript' src='../scripts/JWPlayer/swfobject.js'></script>
<script type='text/javascript'>
var video=Get_Cookie("sodemand");
var s3file="http://test.cloudfront.net/"+video+"?Policy=<policy string>&Signature=<privacy signature>&Key-Pair-Id=<key pair ID>";
var s1 = new SWFObject('../scripts/JWPlayer/player.swf','player','712','420','9');
s1.addParam('allowfullscreen','true');
s1.addParam('allowscriptaccess','always');
s1.addVariable('file',s3file);
s1.addVariable('image',<image location>);
s1.addVariable('autostart','true');
s1.write('preview');
Delete_Cookie(<cookie information>);
</script>
urlencode the file URI so it doesn't get confused with the flashvars stacking characters.
From Bobby van der Sluis, one of the developers of SWFObject.
"SWFObject complies with Adobe's usage of
flashvars, so for both static and dynamic publishing we adhere to the
same flashvars syntax as Adobe (or Macromedia) has originally defined.
According to these syntax rules certain special characters and the
symbols = and & cannot directly be used inside flashvars values (the
latter because they are used to stack the flashvars themselves). You
can workaround this issue by escaping these characters before passing
them as flashvar values.
Our documentation refers to Adobe's documentation:
http://kb2.adobe.com/cps/164/tn_16417.html
This behavior is documented in Q9 of our FAQ:
http://code.google.com/p/swfobject/wiki/faq
Which in its turn refers to:
http://kb2.adobe.com/cps/141/tn_14143.html"
var s3file = <strong>encodeURIComponent(</strong>"http://test.cloudfront.net/"+video+"?Policy=<policy string>&Signature=<privacy signature>&Key-Pair-Id=<key pair ID>"<strong>)</strong>;The length doesn't matter, I've tested using more than 2,000 characters with no issues (well — there IS a 99,999 character limit in the player code — so don't get carried away).
Read the Tutorial Embedding Flash on the Tutorials page.