我正在玩mediaelement.js
到目前为止非常好当我针对小型设备时,我只是面临一个小问题,视频不会自动调整为新设备尺寸
我怀疑#containingBlock是有问题的,所以我试图用媒体查询来定位它
我已经尝试过Chris Coyer对响应式视频的建议 responsive video tutorial 但它搞砸了mediaelement.js outpout
也许有人知道如何为iphone发行
我的页面位于my page
我使用以下html来嵌入我的视频
<div id="containingBlock">
<video id="introVid" poster="http://med-innovation.com/wp-content/themes/med/images/video_start.png" controls="control" preload="none">
<source src="http://med-innovation.com/wp-content/themes/med/media/ElevatorPitch.mp4" type="video/mp4" />
<source src="http://med-innovation.com/wp-content/themes/med/media/ElevatorPitch.webm" type="video/webm" />
<source src="http://med-innovation.com/wp-content/themes/med/media/ElevatorPitch.ogv" type="video/ogg" />
<object type="application/x-shockwave-flash" data="http://med-innovation.com/wp-content/themes/med/build/flashmediaelement.swf">
<param name="movie" value="http://med-innovation.com/wp-content/themes/med/build/flashmediaelement.swf" />
<param name="flashvars" value="controls=true&file=http://med-innovation.com/wp-content/themes/med/media/ElevatorPitch.mp4" />
<img src="http://med-innovation.com/wp-content/themes/med/images/fail.jpg" width="640" height="360" title="Il n'est pas possible de visionner une video avec votre navigateur" />
</object>
</video>
<script>
jQuery(document).ready(function($)
{
// declare object for video
var player = new MediaElementPlayer('#introVid',
{
// if the <video width> is not specified, this is the default
defaultVideoWidth: 640,
// if the <video height> is not specified, this is the default
defaultVideoHeight: 360,
// if set, overrides <video width>
videoWidth: -1,
// if set, overrides <video height>
videoHeight: -1,
// enables Flash and Silverlight to resize to content size
enableAutosize: true,
// the order of controls you want on the control bar (and other plugins below)
features: ['playpause','loop','current','progress','duration','volume'],
success: function (mediaElement, domObject)
{
// add event listener
mediaElement.addEventListener('ended', function(e)
{
window.location = "http://med-innovation.com/choice/";
}, false);
}
});
});
</script>
和css我有
video {width: 100% !important; height: auto !important;}
#containingBlock {
width: 640px;
height: 360px;
margin: 0 auto;
text-align:center;
}
@media(max-width: 520px)
{
#page-wrap, #colophon {width: auto; margin: 7px auto; }
#containingBlock {
width: 100%;
height: 100%;
margin: 0 auto;
text-align:center;
}
}