如何使 MediaElement.js 流畅?
我一直在研究代码,但似乎无法让它工作。我用谷歌搜索,在这个网站上搜索了 13 页,但我仍然找不到我正在寻找的答案。
我想让视频以特定尺寸开始,然后随着我调整浏览器大小(从桌面到 iPad/iPhone)而缩小。
我尝试过执行以下操作,但视频保持不变。没有任何东西可以缩放。
<div id="myVideo" style="width:640px; height:360px">
<video id="player1" width="100%" height="100%" style="width:100%; height:100%;">
<!-- Pseudo HTML5 -->
<source type="video/youtube" src="http://www.youtube.com/watch?v=nOEw9iiopwI" />
</video>
</div>
我应该采取什么不同的做法?
I've been playing around with the code and I can't seem to get this to work. I've googled, searched on this site looking through 13 pages and I still can't find the answer to what I'm looking for.
I want to have a video start out with a specific dimension and then scale down as I resize the browser (going from desktop to iPad/iPhone).
I've tried doing the below, but the video stays the same. Nothing scales.
<div id="myVideo" style="width:640px; height:360px">
<video id="player1" width="100%" height="100%" style="width:100%; height:100%;">
<!-- Pseudo HTML5 -->
<source type="video/youtube" src="http://www.youtube.com/watch?v=nOEw9iiopwI" />
</video>
</div>
What should I be doing differently?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
将视频节点的高度/宽度属性设置为原始视频大小,但将样式宽度/高度保持为 100%,如下所示
,然后根据需要调整 myVideo div 的大小,mejs 应按预期响应
set your video node's height/width attributes to the original video size, but keep the style width/height at 100% like this
then resize your myVideo div as necessary and mejs should respond as expected
好吧,您在 #myVideo div 上设置了特定大小 (640px 360px),因此内部的视频元素是该框的 100%。如果您删除像素尺寸 - 或尝试将它们更改为最大 - 它应该是可扩展的。
Well, you have a specific size (640px 360px) set on the #myVideo div, so the video element inside is 100% of that box. If you remove the pixel dimensions - or try changing them to max- -- it should be scalable.
这有效。 myvids div 中的 width = "50%" 适用于 IE。如果没有它,视频将无法正确填充播放器。视频属性的顺序似乎确实很重要。
This works. The width = "50%" in the myvids div is there for IE. Without it the video does not properly fill the player. Order of the video attributes really seems to matter.