It can be quite difficult to round the corners of embedded Flash videos like those from YouTube and Vimeo due to compatibility issues with older browsers.
If all your users are using HTML5-supported browsers, simply adding player=html5
to the iframe
link will ensure that the border-radius
works smoothly:
http://www.youtube.com/embed/QKh1Rv0PlOQ?rel=0&player=html5
.
However, if some users' browsers do not support HTML5, things get complicated. One workaround is customizing styles for each browser and using !important
tags along with adding wmode=transparent
to the iframe
link:
http://www.youtube.com/embed/QKh1Rv0PlOQ?rel=0&wmode=transparent
. This may improve compatibility across different browsers.
For legacy browser support (such as Internet Explorer 6), the most reliable method involves creating an image resembling a curved corner and overlaying it on each corner of the video. Ensure to use the wmode=transparent
trick to prevent display issues.
Check out this example applying the image overlay technique to an iframe
-embedded YouTube video: http://jsfiddle.net/skywalkar/uyfR6/ (radius = 20px).
Keep in mind that larger corner overlays may cover player controls. To mitigate this, consider rotating the images by 45 degrees for a different set of overlays and adjusting margins accordingly. Here's an example with a radius of 30px: http://jsfiddle.net/skywalkar/BPnLh/.