Include this script into your page along with the iframe for a responsive media embed
Using a variant of the Douglas-Peucker algorithm in conjunction with the CurveFitting algorithm from Philip J. Schneider found in Graphics Gems I, I wrote this in ...