Foliovision › Forums › FV Player › Requests and Feedback › Using Amazon S3 signed URLs
-
Hello,
I’m using a piece of code to generate a signed Amazon URL for the video and feeding that URL to the FV WP Flowplayer short code.
When the URL has “%” symbols in the signature, the player is converting parts of the signature into HTML Entities.
Example, when I supply the following, signed URL…
http://…/file.mp4?AWSAccessKeyId…&Expires=1373240008&Signature=lOLsfId2a%2B5If….mQY%3D
The player sends the following request to amazon…
http://…/file.mp4?AWSAccessKeyId=…&Expires=1373240008&Signature=lOLsfId2a+5If…mQY=
Notice that the plugin converted the “%2B” in the signature to a “+” and the “%3D” to an “=”
This URL is – of course rejected by Amazon.
Is there a way for me to used signed URLs and NOT have the plugin alter the signature in this way?
Hoping you can help.
Jason
-
-
Martin,
I’m using S3mediavault to create the urls that I then pass to FV WordPress Flowplayer.
If you wanted to build this feature into the your plugin – which would be awesome – the Amazon API explains everything:
http://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html
I reached out to a developer friend of mine who was able to build me a quick plugin to deal with the “%2B” issue that I was having below, so everything is working for me now. If you like I can put you in touch with him…
Jason
Hello Martin,
After a bit of trial and error, I was able to isolate the problem to the flashvars parameter which is passed to flowplayer.swf. If there is a + in the Signature portion of the video url (encoded as %2B by either fvplayer or s3mv plugins), the video fails to load. The reason I believe this is happening is that the %2B is decoded back to a + before the media is requested from S3, which then decodes the + as a space, causing the request to fail. If the + remains encoded as %2B in the request to S3, the video loads fine.
I first attempted to resolve this by double-encoding that parameter (effectively encoding the % before the 2B), with the + now encoded as %252B in the page source. This also failed. Using Chrome dev tools, I could see that the url requested from S3 still had the + instead of %2B. I’m assuming that the flash player is decoding the url multiple times before finally requesting the file from S3. The solution that worked was to have the + encoded as %25252B. When encoded as such, the request to S3 now has a %2B instead of a + in the url.
I wrote a very simple plugin (attached to a private email) that overrides the [fvplayer] shortcode and does a quick regex search/replace on the S3 url portion of the output. I’m fairly new to PHP and WordPress, so there may be a better approach, but this seems to be working quite well for us at the moment.
I hope this helps!
– Jeremy
Hi Jason and Jeremy,
thank to both of you for your input.
Today we worked on adding the Amazon S3 protection support straight in to our plugin but I was not able to replicate your bug yet.
But I’ll have one more look at Jeremy’s code to figure out what could it be that it’s breaking for you.
Thanks,
MartinHello Jason and Jeremy,
we just released version 2.1.24. It includes the fix for passing Amazon S3 signed URLs to the Flash version of the player.
It was actually a bit trickier, as the correction of %2B needs to happen for Flash only. HTML5 player needs the URL without the fix. We also had to make sure the video checker works with these URLs too. Now we will concentrate on our own implementation of the Amazon S3 signed URLs, which will also work with cache plugins etc.
Jason, since you already have a license, we added one more domain slot for you.
Jeremy, we added a thank you note in our change log.
Thanks,
MartinAnonymous 11 years agoGünstige microsoft office 2010 professional Windows 8 Key – Computer und Prozessor. Darüber hinaus müssen alle Dienste im selben Prozess unter dem gleichen Account durchgeführt werden. Vereinfachte 3D-Design in Photoshop Extended, professional 2010 Office OEM 64 Bit. In einigen Fällen in der oberen rechten Ecke des Symbols windows 7 key befindet sich in einem triangle.Some der Ideen scheinen durchaus sinnvoll und vertretbar ist, wie die Ausrichtung des dauerhaften und zuverlässigen Tests angezeigt. Unterstützte Dateisysteme und Geräte, Microsoft Office Professional zu verkaufen 64 Bit. Aus funktionaler windows 7 key kaufen Sicht, erhält der Prozess das gleiche Ergebnis, aber der Charakter-Schnittstelle kann viel schneller laufen. Das Ziel der Forschung war die Entwicklung von internationalen Standards für die Übertragung von Daten aus diesen Arten von Computer networks.As Sie sehen können, kam es gut. Typ Bild an dieser Stelle in der Zeichnung dargestellt. office 2010 key Was ist Photoshop Extended, billig Microsoft Office 2010. Erstellen Sie einen Teilbereich des Snap. Lesen Sie mehr über den geistigen Fortschritt der Lektüre und schnell vvodevyvode wir später erzählen werden.
Sorry guys … disabled Jeremys’ plugin fix and updated the FV WordPress
Flowplayer plugin and now the videos won’t load.‘http://www…..com/launch/’
Hello Jason,
we are sorry about the inconvenience, however –
I refreshed the page many times and the video always played for me (in HTML5 in Safari and Flash in Firefox and IE 10 and also on iPad).
I was checking the source code and could see how the fix for %2B works for Flash and not for HTML5, as it’s supposed to. The secured video URL is also visible above the “Benefits of Membership” heading, looks like you left it there for debugging.
Please let us know if there was some issue which you had to figure out (perhaps to make it works with your Amazon S3 plugin) or if you are still having the issue and in which browser.
Thanks,
MartinHello Jason,
Chrome 21.0.1180.90 on Mac OS X 10.5.8 fails for me sometimes. I mean when I reload it plays, but sometimes it won’t. Same for Chrome 28.0.1500.72 m on Windows 8.
It happens even with URLs without %2B in them.
Please try to disable the autobuffering, we had these Chrome issues with some MOV files an disabling autobuffering seemed to help: http://foliovision.com/support/fv-wordpress-flowplayer/troubleshooting/mov-videos#post-1906
Please let us know, we should disable autobuffering for Chrome when using both MP4 and MOV if it helps.
Thanks,
MartinHello Jason,
thank you for the kind words!
We will update this thread when our own code to deal with secure Amazon URLs is ready, so you can give it a try.
We will probably disable autobuffer for Chrome for these secure Amazon URLs. And also MOV files as it was causing issues in other thread (.mov videos?).
Thanks,
MartinHello Jason,
we just released version 2.1.32 which has support for Amazon S3 protected URLs.
You can enter your bucket name and API keys in Settings -> FV WordPress Flowplayer -> Amazon S3 Protected Content box.
Then just paste the full file URL as a source of the video, like this:
[fvplayer src="https://s3-eu-west-1.amazonaws.com/flowplayer500600/videos/31-alderbrook-branded-1.mp4"]
When you save the post, the file is examined and the expire time is set to its length, otherwise the default is 5 minutes.
If the site visitor comes to the video later that day and tries to play it, it will fail gracefully – telling him that the video expired and he needs to reload the page.
If you have some time to check this out, that would be great. Now I need to put up a proper documentation for this.
Thanks,
MartinHey Martin,
I updated the plugin and attempted to add a bucket but I get the following error on the admin screen: Warning: Invalid argument supplied for foreach() in /…/wp-content/plugins/fv-wordpress-flowplayer/view/admin.php on line 82
And the “Add More Amazon S3 Secure Buckets” button doesn’t appear to do anything.
When I look at your code, line 76 through 80, $fv_fp->conf[‘amazon_bucket’] is a string so it makes sense that the foreach is having trouble.
If I manually instantiate the three variables above as arrays, the admin screen shows the way it’s supposed to.
Great job guys!
This is fast becoming my most favorite plugin! J
Looks like the Amazon S3 feature works great so far! Just tested it with a protected file and it seems to work well. I think all you have to do is fix the admin screen issue and you’re golden. I’ll lean on it some more tomorrow and let you know if I find anything else.
J
Hello Jason,
sorry about that, it’s really a rookie level mistake. I only tested installing the plugin from scratch and not the upgrading from one of the recent versions.
It’s fixed now and it will go into new version today.
We are happy if you like the plugin. If you could check out what happens if you open a post, then wait for an hour (needs to be longer than the video duration or 15minutes – we want to lower it to 5 minutes actually) or so and try to play it, that would be great. You should get a nice message that you need to reload the page.
Thanks,
MartinHi Martin,
Ran the test. Opened the post, went away for a couple of hours, returned, clicked play and received a message that says, “Video file expired. Please reload the page and play it again.”
This is an excellent feature as my other setup would result in a message that said something like, “File not found” which I knew would be confusing. I actually had to hack the code in the plugin I was using to generate the signed URLs because I felt I needed to extend the expiry time out to several hours just to reduce the chance that someone might get a message like that and be confused. Now, with your new feature, not only do I have full control over the expiry time through the UI but the user is also given a helpful message in the event the page does expire – perfect!
Great job guys!!!!
J