VideoJS 和 swfobject 嵌入问题
我正在使用 VideoJS 和 SWFObject 用于嵌入视频。这个想法是,VideoJS 将尝试使用 HTML5 视频标签,如果不支持,将回退到 Flash。我正在尝试使用 SWFObject 嵌入 Flash 以用作后备。相关代码如下:
<ul id="client_gallery">
<% if PortfolioMedia %>
<% control PortfolioMedia %>
<% if VideoFile %>
<li style="width:{$VideoWidth}px;height:{$VideoHeight}px">
<div class="video-js-box">
<video class="video-js" width="$VideoWidth" height="$VideoHeight" controls preload>
<source src="$VideoFile.URL" type="video/mp4" />
<div id="flash_player"></div>
<script type="text/javascript">
var flashvars = {
'file': "$VideoFile.URL"
};
var params = {
'allowfullscreen': "true",
"wmode": "transparent"
};
var attr = {
'id': 'f_player',
'name': 'f_player'
};
swfobject.embedSWF('/portfolio/javascript/jwplayer/player.swf', 'flash_player', '$VideoWidth', '$VideoHeight', '9', '', flashvars, params, attr, function(e){
});
</script>
</video>
</div>
</li>
<% end_if %>
<% end_control %>
<% end_if %>
<script type="text/javascript">
$(function(){
VideoJS.setupAllWhenReady();
});
</script>
</ul>
另一个表示法来自 CMS Silverstripe,与本期无关。这在 Chrome、Safari 和 IE 中工作正常,但在 Firefox 中不行。在 Firefox 中,我得到的只是一个空容器,就好像它试图使用 标签但无法加载兼容的源一样。
它根本没有嵌入 Flash,而且我知道 swfobject 代码正在工作,因为如果我只使用 swfobject 代码,而不是在 标记内,它就可以完美工作。所以问题是:VideoJS 不会回退到 swfobject 嵌入的代码。但为什么?
I'm using VideoJS and SWFObject to embed videos. The idea is that VideoJS will try to use the HTML5 video tag and will fallback on Flash if it is not supported. I'm trying to use SWFObject to embed the Flash to use as fallback. Here's the relevant code:
<ul id="client_gallery">
<% if PortfolioMedia %>
<% control PortfolioMedia %>
<% if VideoFile %>
<li style="width:{$VideoWidth}px;height:{$VideoHeight}px">
<div class="video-js-box">
<video class="video-js" width="$VideoWidth" height="$VideoHeight" controls preload>
<source src="$VideoFile.URL" type="video/mp4" />
<div id="flash_player"></div>
<script type="text/javascript">
var flashvars = {
'file': "$VideoFile.URL"
};
var params = {
'allowfullscreen': "true",
"wmode": "transparent"
};
var attr = {
'id': 'f_player',
'name': 'f_player'
};
swfobject.embedSWF('/portfolio/javascript/jwplayer/player.swf', 'flash_player', '$VideoWidth', '$VideoHeight', '9', '', flashvars, params, attr, function(e){
});
</script>
</video>
</div>
</li>
<% end_if %>
<% end_control %>
<% end_if %>
<script type="text/javascript">
$(function(){
VideoJS.setupAllWhenReady();
});
</script>
</ul>
The other notation is from the CMS Silverstripe, which is irrelevant in this issue. This works fine in Chrome, Safari, and IE but not in Firefox. In Firefox all I get is an empty container, as if it was trying to use the <video>
tag but couldn't load a compatible source.
It is not embedding Flash at all, and I know the swfobject code is working because if I use just the swfobject code, not within the <video>
tag, it works perfectly. So the problem is: VideoJS won't fallback to code embedded by swfobject. But why?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
videojs 已经内置了 Flash 支持作为后备。如果您想使用自己的 Flash 播放器,您可以在选项中更改它,例如:
附加:swfObject 已包含在 videojs 中。
videojs already ha a build in flash support build in as fallback. If you want to use your own flash player you can change it in the options for example:
additional: swfObject is already in videojs included.