当打开直接指向audioplayer的链接时,所有浏览器都会播放它们。 Audioplayer是 在嵌套的div中,嵌入元素指向swf。
但是当写入并嵌入某个页面时会显示播放器,但它不能在IE8中播放。适用于所有其他主流浏览器,包括IE9。
BTW它在Safari中不起作用,但是为足够大的值分配宽度和高度为Safari修复了它,而不是IE8。
<iframe width="500" height="50" src="http://localhost/getAudio?id=DB04DDA8-C7C9-46E6-B0B3-7A0E0B5C9A55" frameBorder="0" scrolling="no">
<html class=" js no-flexbox no-canvas no-canvastext no-webgl no-touch no-geolocation postmessage no-websqldatabase no-indexeddb hashchange no-history draganddrop no-websockets no-rgba no-hsla no-multiplebgs no-backgroundsize no-borderimage no-borderradius no-boxshadow no-textshadow no-opacity no-cssanimations no-csscolumns no-cssgradients no-cssreflections no-csstransforms no-csstransforms3d no-csstransitions fontface generatedcontent no-video no-audio localstorage sessionstorage no-webworkers no-applicationcache no-svg no-inlinesvg no-smil no-svgclippaths" xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<STYLE class=iepp-printshim media=print></STYLE>
<TITLE>Bethoven symphony # 9</TITLE>
<META charset=utf-8>
<SCRIPT type=text/javascript src="/celenium/scripts/libs/jquery-latest.js"></SCRIPT>
<SCRIPT type=text/javascript src="/celenium/scripts/ClientCompatibility.js"></SCRIPT>
<STYLE type=text/css>BODY {
PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px
}
</STYLE>
</HEAD>
<BODY>
<DIV id=asset01>
<SCRIPT type=text/javascript>
$.ajax({
url: '/celenium/audioplayer_html5/getPlayer.asp?o=DB04DDA8-C7C9-46E6-B0B3-7A0E0B5C9A55',
dataType: 'jsonp',
cache: true,
jsonpCallback: 'sdlaudioplayer',
success: function (data) {
$('#asset01').append($(data.html));
}
});
</SCRIPT>
<LINK rel=stylesheet href="http://localhost/celenium/audioplayer_html5/css/defaultplayer.css" media=screen>
<DIV id=sdlaudioplayer class=player_container>
<DIV class=player_metabar></DIV>
<DIV class=player_controls>
<DIV style="DISPLAY: block" class=player_controls_play jQuery1707536265854468271="1"></DIV>
<DIV style="DISPLAY: none" class=player_controls_pause jQuery1707536265854468271="2"></DIV>
<DIV style="DISPLAY: none" class=player_controls_prev jQuery1707536265854468271="3"></DIV>
<DIV style="DISPLAY: none" class=player_controls_next jQuery1707536265854468271="4"></DIV>
<DIV style="WIDTH: 297px; DISPLAY: block" class=player_controls_scrubber jQuery1707536265854468271="5">
<DIV class=player_controls_scrubber_loading jQuery1707536265854468271="13">
<DIV class=player_controls_scrubber_loaded></DIV>
<DIV class=player_controls_scrubber_playhead></DIV></DIV></DIV>
<DIV style="DISPLAY: block" class=player_controls_timing jQuery1707536265854468271="6"><SPAN class=player_controls_timing_position>0:00</SPAN> / <SPAN class=player_controls_timing_total>0:00</SPAN></DIV>
<DIV style="DISPLAY: block" class=player_controls_volume jQuery1707536265854468271="7">
<DIV class=player_controls_volume_mute jQuery1707536265854468271="8"></DIV>
<DIV class=player_controls_volume_slider jQuery1707536265854468271="12">
<DIV style="WIDTH: 50%" class=player_controls_volume_marker jQuery1707536265854468271="11"></DIV>
<DIV style="LEFT: 28px" class=player_controls_volume_knob jQuery1707536265854468271="10"></DIV></DIV>
<DIV class=player_controls_volume_max jQuery1707536265854468271="9"></DIV></DIV></DIV></DIV>
<DIV id=sm2-container class="high_performance movieContainer swf_loaded"><!-- SM2 flash goes here -->
<DIV></DIV>
<DIV class=sm2-object-box>
<OBJECT id=sm2movie title="JS/Flash audio component (SoundManager 2)" codeBase="download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 data="/celenium/audioplayer_html5/swf/soundmanager2_flash9.swf" width=auto type=application/x-shockwave-flash height=auto></OBJECT></DIV></DIV></DIV></BODY>
答案 0 :(得分:1)
IE8不被视为现代浏览器,因为它不支持许多HTML5功能,例如音频和视频标签。
此HTML5 Tutorial网站提供了如何使用Object标记在IE8中支持音频的示例。见下面的例子:
<audio controls>
<source src="vincent.mp3" type="audio/mpeg"/>
<source src="vincent.ogg" type="audio/ogg"/>
<object type="application/x-shockwave-flash" data="media/OriginalMusicPlayer.swf"
width="225" height="86">
<param name="movie" value="media/OriginalMusicPlayer.swf"/>
<param name="FlashVars" value="mediaPath=vincent.mp3" />
</object>
</audio>
请记住,这需要IE8客户端安装了Flash,因为它使用Flash来加载播放器。
如果客户端没有安装Flash,那么您最后的努力就是提供一个下载链接,让用户使用操作系统的默认播放器来播放音频文件:
<audio controls>
<source src="vincent.mp3" type="audio/mpeg"/>
<source src="vincent.ogg" type="audio/ogg"/>
<object type="application/x-shockwave-flash" data="media/OriginalMusicPlayer.swf"
width="225" height="86">
<param name="movie" value="media/OriginalMusicPlayer.swf"/>
<param name="FlashVars" value="mediaPath=vincent.mp3" />
</object>
<a href="vincent.mp3">Download this lovely song and wish you all the best!</a>
</audio>
作为旁注,您面临的问题很可能源于您的HTML缺少html5文档类型并包含验证错误。您可能想查看W3C规范。我相信你的所有属性都应该引用它们。
虽然许多浏览器都擅长让您在HTML中出现语法和语义错误并且只是将它放在一边,但有时这些验证问题可能会让您感到困扰。我强烈建议您针对W3C validator运行您的网站,以确保没有任何HTML错误阻止IE8正确解释您的标记。