wysiwyg - Embed YouTube: dimensions -
is safe fix width of embedded youtube video , let height take care of itself?
i have application users post notices notice board. notices text (with limited html tags) , embedded images. adding support embedded youtube videos.
the posts come in 2 different body sizes: 298px , 638px. when user wants embed video go youtube.com, find video, select share->embed. copy iframe code , paste in post creating.
here's example of iframe code youtube video:
<iframe width="560" height="315" src="https://www.youtube.com/embed/ny7ysh6y2g0" frameborder="0" allowfullscreen></iframe>
i using redactor wysiwyg (http://imperavi.com/redactor/), makes easy update attributes of uploads , embeds, planning set width (to either 298px or 638px), , remove height. few tests have done seem work fine, don't understand way youtube works aspect , dimensions.
i think height automatically set using aspect ratio appropriate viewing (16:9?), can sure without testing heaps of examples. proposing going give users viewing experience?
removing height
iframe
not guarantee correct aspect ratio. pointed out in comments, youtube cannot interact page in way. iframe
size controlled entirely , it's content plays no part in size.
if wish resize iframe
according correct aspect radio, can use technique outlined in post:
Comments
Post a Comment