IE9 中的 JW Player 无法加载和播放 MP3 文件
这很简单,我有一个链接列表,如果用户单击链接,div 就会加载一些内容(jwplayer 占位符和歌曲标题),并且 jwplayer 应该启动。这是我的 javascript (jquery 和 jquery-swfobject):
$(function() {
$('.song a').live('click', function() {
var title = $(this).find('span.title').text();
var file = $(this).attr('href');
$.ajax({
type: 'POST',
url: $('.songlocation').html(),
data: 'name=' + title + '&file=' + file,
success: function(html) {
$('.songplayer').attr('title', title);
$('.songplayer').html(html);
},
complete: function(request, status) {
$('#mediaspace').flash({
swf: $('.flashlocation').html(),
allowfullscreen: true,
allowscriptaccess: 'always',
wmode: 'opaque',
width: 238,
height: 24,
flashvars:
{
file: file,
autostart: true
}
});
if ($('#mediaspace').text().indexOf("Flash is disabled") == -1) {
$('.songplayer').show();
} else {
document.location = file;
}
}
});
return false;
});
});
$('.songlocation') contains /Home/SongPlayer
/Home/SongPlayer contains:
<div id="mediaspace">
Flash is disabled
</div>
<div id="name">
Song Title
</div>
<a href="http://url/to.mp3" class="download">Download MP3 >></a>
这在 Opera/Firefox/Chrome/IE7/IE8 中工作得很好,但在 IE9 中不行 jwplayer 加载得很好,但不能加载歌曲。所以 IE9 中永远不会调用 MP3 文件
It's quite simple, I have a list of links, and if a user clicks a link a div gets loaded with some content (jwplayer placeholder and song title) and the jwplayer should startup. This is my javascript (jquery and jquery-swfobject):
$(function() {
$('.song a').live('click', function() {
var title = $(this).find('span.title').text();
var file = $(this).attr('href');
$.ajax({
type: 'POST',
url: $('.songlocation').html(),
data: 'name=' + title + '&file=' + file,
success: function(html) {
$('.songplayer').attr('title', title);
$('.songplayer').html(html);
},
complete: function(request, status) {
$('#mediaspace').flash({
swf: $('.flashlocation').html(),
allowfullscreen: true,
allowscriptaccess: 'always',
wmode: 'opaque',
width: 238,
height: 24,
flashvars:
{
file: file,
autostart: true
}
});
if ($('#mediaspace').text().indexOf("Flash is disabled") == -1) {
$('.songplayer').show();
} else {
document.location = file;
}
}
});
return false;
});
});
$('.songlocation') contains /Home/SongPlayer
/Home/SongPlayer contains:
<div id="mediaspace">
Flash is disabled
</div>
<div id="name">
Song Title
</div>
<a href="http://url/to.mp3" class="download">Download MP3 >></a>
This works perfectly fine in Opera/Firefox/Chrome/IE7/IE8, but not in IE9
The jwplayer loads just fine, but not the song. So the MP3 file is never being called in IE9
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看来问题是 jquery-swfobject 插件。我已将 swfobject 的 jquery 版本(旧版本)替换为 swfobject 2.0,现在它工作正常。
It seems the problem is the jquery-swfobject plugin. I have replace the jquery version of swfobject (old one) by swfobject 2.0 and now it is working fine.