gpt4 book ai didi

javascript - Videojs 使 SWF 后备响应

转载 作者:行者123 更新时间:2023-11-28 01:45:19 25 4
gpt4 key购买 nike

我目前正在使用 videojs 插件,我已经设法让它响应以下代码:

JSFIDDLE DEMO

JS:

videojs.options.flash.swf = "../../js/video-js.swf";

// Once the video is ready
videojs("#video").ready(function(){

var myPlayer = this; // Store the video object
var aspectRatio = 4/3; // Make up an aspect ratio

function resizeVideoJS(){
// Get the parent element's actual width
var width = document.getElementById(myPlayer.R).parentElement.offsetWidth;
// Set width to fill parent element, Set height
myPlayer.width(width).height( width * aspectRatio );
}

resizeVideoJS(); // Initialize the function
jQuery(window).on('resize', function () {
resizeVideoJS(); // Call the function on resize
})
});

HTML:

<div class="feature-video">
<video id="video" class="video-js vjs-default-skin" controls preload="none"
poster="http://video-js.zencoder.com/oceans-clip.png"
data-setup="{}">
<source src="http://video-js.zencoder.com/oceans-clip.mp4" type='video/mp4' />
<source src="http://video-js.zencoder.com/oceans-clip.webm" type='video/webm' />
<source src="http://video-js.zencoder.com/oceans-clip.ogv" type='video/ogg' />
</video>
</div>

最佳答案

看看这个

fiddle link

<div class="feature-video">
<video id="video" class="video-js vjs-default-skin vjs-fullscreen" controls preload="none" width="auto" height="auto" poster="http://video-js.zencoder.com/oceans-clip.png"
data-setup="{}">
<source src="http://video-js.zencoder.com/oceans-clip.mp4" type='video/mp4' />
<source src="http://video-js.zencoder.com/oceans-clip.webm" type='video/webm' />
<source src="http://video-js.zencoder.com/oceans-clip.ogv" type='video/ogg' />
</video>
</div>

关于javascript - Videojs 使 SWF 后备响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23172849/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com