视频标签在IE 9中不起作用 [英] Video tag not working in IE 9
本文介绍了视频标签在IE 9中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用此代码使用jQuery创建元素
function fsuccLoadVideo(data){
var arr = GetNormalizeMetadataClean(data);
var vid = $('< video width = 400 height = 300 controls poster ='+ arr [0] [CntrTestVideoImage] +'/>');
var loc = window.location.href;
var idx = loc.lastIndexOf('/')+ 1;
var mp4loc = loc.substr(0,idx)+ arr [0] [CntrTestVideoMp4Src];
loc = loc.substr(0,idx)+ arr [0] [CntrTestVideoOggSrc];
if((arr [0] [CntrTestVideoMp4Src]!= undefined)&&(arr [0] [CntrTestVideoMp4Src]。length> 0)){
$(< ; source />,{src:loc,type:'video / webm; codecs =vp8,vorbis'})。appendTo(vid);
$(< source />,{src:mp4loc,type:'video / mp4; codecs =avc1.42E01E,mp4a.40.2'})。appendTo(vid);
$(< source />,{src:loc,type:'video / ogg; codecs =theora,vorbis'})。appendTo(vid);
$(vid).append(您的浏览器不支持视频标签);
$(#videosection)。append(vid);
}
}
它在浏览器上呈现方式:
< source
src =http://10.1.16.102:90/Intranet/safety/ contractortest / video / cntrTest1.ogg
type =video / webm; codecs =vp8,vorbis>
(无法正确显示格式以显示完整渲染,但这里是关键行
解决方案
ie9仅支持webm,如果您将其安装为第三方应用程序。
The video tag I'm building will not work in IE9. Its works ok in Firefox and Chrome.
I added the mime to the IIS 7.5 server Extension=.mp4 Mime Type=video/mp4
I create the elements with jQuery using this code
function fsuccLoadVideo(data) {
var arr = GetNormalizeMetadataClean(data);
var vid = $('<video width=400 height=300 controls poster=' + arr[0]["CntrTestVideoImage"] + '/>');
var loc = window.location.href;
var idx = loc.lastIndexOf('/') + 1;
var mp4loc = loc.substr(0, idx)+ arr[0]["CntrTestVideoMp4Src"];
loc = loc.substr(0, idx)+ arr[0]["CntrTestVideoOggSrc"];
if ((arr[0]["CntrTestVideoMp4Src"] != undefined) && (arr[0]["CntrTestVideoMp4Src"].length > 0)) {
$("<source />", { src: loc, type: 'video/webm; codecs="vp8, vorbis"' }).appendTo(vid);
$("<source />", { src: mp4loc, type: 'video/mp4; codecs="avc1.42E01E, mp4a.40.2"' }).appendTo(vid);
$("<source />", { src: loc, type: 'video/ogg; codecs="theora, vorbis"' }).appendTo(vid);
$(vid).append("Your browser does not support the video tag");
$("#videosection").append(vid);
}
}
and it renders on the browser this way:
<source
src="http://10.1.16.102:90/Intranet/safety/contractortest/video/cntrTest1.ogg"
type="video/webm; codecs="vp8, vorbis"">
(can't get formatting correct to show full rendering, but here is the critical line
解决方案
ie9 only supports webm if you install it as 3rd party app.
这篇关于视频标签在IE 9中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文