This demand is long-standing, the company's voice orders a lot, every customer service is from the server down voice to listen. Very inconvenient. So I went online ba la to see what the Web Player can play AMR format audio files, AMR Baidu Encyclopedia
Anyway, I've been looking for a long time. , and then discover that Apple's QuickTime player player can play.
The steps are as follows:
1. Download QuickTime Player
2. Mime.type support for adding Web servers on the server side is the Apache, Nginx, and the like. mime.type files are added as follows
- AUDIO/AMR AMR
- AUDIO/AMR-WB AMR
- audio/amr-wb+ AMR
- AUDIO/AMR AMR Amr
3. Insert the following code on the page
Source copy print About
- <button class="Icon-audio" id="playerbtn" style= "margin:0 5px;cursor:pointer; "Playerurl=" Http://xxx.com/abc.amr "> Play </button>
- <div style="width:1px;height:1px;" id="PLAYERQT" >
- </div>
- The JS code is as follows: Okay, I'll use jquery to replace it.
- var playerqt = document.getElementById ("PLAYERQT");
- $ ("#playerBtn"). Bind ("click",function (e) {
- var playerurl = E.target.getattribute ("Playerurl");
- Playeraudio (Playerurl);
- });
- function Playeraudio (URL) {
- var html = ' ltembed width= ' 1px "height=" 1px "name=" plugin "src=" ' +url+' "type=" Audio/amr "id=" Qt_emb ">";
- playerqt.innerhtml = html;
- }
4. In the URL to get this AMR, add the header of the server code as follows
- Header (' Content-type:audio/amr ');
Original address: http://myway.sinaapp.com/30.html
Http://blog.sina.com.cn/s/blog_c70924a60101gwgm.html
How Web pages play AMR's audio files