简体   繁体   English

Mediaelement js没有在IE中播放mp3

[英]Mediaelement js is not playing mp3 in IE

This is my first post here, so forgive me if i don't follow all the unwritten laws here :) 这是我在这里的第一篇文章,所以如果我不遵守这里所有不成文的法律,请原谅我:)

I am using mediaelement.js for playing mp3 files. 我正在使用mediaelement.js播放mp3文件。 It works great in all the browsers i have tested, except from IE11. 它在我测试过的所有浏览器中都很好用,除了IE11。 I get an errer in my browser saying "Invalid source". 我在浏览器中看到一个错误消息,说“来源无效”。 The soundfiles i use are loaded from a database, and a typical URL for a file would be /filestreamer?fileId=2342342 我使用的声音文件是从数据库加载的,文件的典型URL为/ filestreamer?fileId = 2342342

As You can see, there is no file extension in the URL. 如您所见,URL中没有文件扩展名。 I wonder if this is what causes the problem in IE? 我想知道这是什么导致IE中的问题吗? Is there anyone who can confirm if that is or is not the case? 有没有人可以确认情况是否如此?

Here's the code i use: fileUrl will be like /filestreamer?fileId=2342342 这是我使用的代码:fileUrl将类似于/ filestreamer?fileId = 2342342

$j("#soundPlayer").append('<audio id="player1" width="100%" poster="poster.jpg" controls="controls" autoplay="true" preload="none"><source type="audio/mp3" src="'+fileUrl+'" /><object width="320" height="240" type="application/x-shockwave-flash" data="/adapt-it/scripts/jquery/johndyer-mediaelement/build/flashmediaelement.swf"><param name="movie" value="/adapt-it/scripts/jquery/johndyer-mediaelement/build/flashmediaelement.swf" /><param name="flashvars" value="controls=true&file='+fileUrl+'" /><img src="myvideo.jpg" width="320" height="240" title="No video playback capabilities" /></object></audio>');

Kindly regards, Lars 亲切的问候,拉斯

It was the mime-type, or content-type if you wish. 如果您愿意,它是mime类型或content类型。 I managed after some debugging to set it to "audio/mp3" and everything worked like a charm. 经过一些调试后,我设法将其设置为“ audio / mp3”,并且一切正常。 Thanks for all help :) 感谢您的所有帮助:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM