kylegilman / video-embed-thumbnail-generator

A WordPress plugin that generates thumbnails, HTML5-compliant videos, and embed codes for locally hosted videos. Requires FFMPEG or LIBAV for encoding.
http://wordpress.org/plugins/video-embed-thumbnail-generator/
GNU General Public License v2.0
48 stars 27 forks source link

AWS CloudFront signed URLs breaking Video tag generation #299

Open ocasta opened 8 years ago

ocasta commented 8 years ago

We have our assets stored on S3 and served through Cloudfront. As long as we don't delete local files then everything seems to work OK. Requesting a page generates a video tag that looks like this: `

            </video>`

We have now added a plugin that generates AWS Signed URLs for media assets (it's a filter on wp_get_attachment_url) and the video tag is now wrong and the page now contains the following

<video id="video_kgvid_0_html5_api" preload="metadata" poster="https://xxx.xxx/app/uploads/2016/03/02141752/thumb171.jpg?Expires=1456934896&amp;Signature=GBAVfdEjqmPaY6uqmrK2HPbWykYPXkbbnWB8laflu11QlY8Fbp4PkJ~ItYqMSijEeyM2ZKGW6Q3l-Y-qITqWf0G9DNmn4KtogviMNKt415dHfWoUF39ur1KRBw8KnEONfWbJqZnYN70Ma4c0kN5NqgvA2MPwxcv5DxRat-mr8vJallImm85HX1eueZt8eK3zOPs-Ul5L-mzWBGH0rZyylABvzDSLdH88g7X6555A9or9k1Wsj~e1wUQn-d8hDqkN5RKgOtjbL2HbDiHwltmEwmDMAh8RUuvnbg444XA5xjBsSPaIQRDQH6rRJQwWQtkK03WHEXfgtfktgHPiXvql6Q__&amp;Key-Pair-Id=ZZZZZZZXXXXXXXX" class="vjs-tech" data-setup="{ &quot;nativeControlsForTouch&quot;: true, &quot;language&quot;: &quot;en&quot; }"> </video>

No sources are being generated. The Signed URL for the video has the same format and query string params as the thumbnail in the poster tag

kylegilman commented 8 years ago

Interesting. I've never heard of signed URLs. I'll look into this, but I wouldn't expect it to work any time soon. I suspect there are some fundamental problems with the way <source> tags are made that will make this difficult to implement.

kylegilman commented 8 years ago

I'm finally going to do some testing on this. What plugin were you using to generate the AWS signed URLs?

ocasta commented 8 years ago

The plugin source is here https://github.com/ocastastudios/wordpress-aws-signed-url

kylegilman commented 7 years ago

This was embarrassingly simple. wp_check_filetype needs an extension at the end of the string and doesn't understand query strings, so when the plugin checked if the original URL was a compatible filetype, the answer was always no. It's been almost a year since you brought this to my attention and I thought it was a much more complicated problem than it was. I apologize and I doubt you're still using my plugin, but your plugin was a big help in solving the problem.

ocasta commented 7 years ago

That's great news. Looking forward to being able to offer our customers secure URLs.