考虑到移动设备的流行,博客插入的视频都是自适应性的。实现方式如下:
<div style="max-width:640px; margin:0 auto 32px;" > <div style="position: relative; width:100%; padding-bottom:65%; /* 16:9 */ height:0;"> <iframe style="position: absolute;top: 0;left: 0;width: 100%;height: 100%;" src="视频地址" frameborder=0 allowfullscreen> </iframe> </div> </div>
根据自己的站点的需要适当修改下margin和max-width,长宽比修改padding-bottom即可。
腾讯视频
腾讯视频与优酷视频的区别在于,没有提供直接的视频播放地址,不要说插入自适应视频了,根本就没法着手,只能求助于万能的度娘,终于找到比较好的解决方法。
第一种方法:
http://static.video.qq.com/TencentPlayer.swf?vid=p0012xby08r&auto=1&outhost=http://cf.qq.com/
第二种方法:
http://imgcache.qq.com/tencentvideo_v1/player/TPout.swf?autoplay=1&outhost=http://cf.qq.com/&skin=http://imgcache.qq.com/minivideo_v1/vd/res/skins/TencentPlayerMiniSkin.swf&vid=k00127k7elf
AUTOPLAY为自动播放设置,1为自动播放0为不自动播放;VID后面为视频的调用ID,ID一般就是网址上.html之前那部分。
转自--从良未遂
Comments | NOTHING