问题
I would like to play a GSM audio file within my HTML5 page
In order to do some testing I created the following piece of code
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>Test</title>
</head>
<body>
<audio controls>
<source src="/home/server/Desktop/audiofile.wav" type="audio/x-wav">
</audio>
</body>
</html>
Unfortunately this code does not work and and the play button is grey.
Details of audio format with soxi
Input File : 'audiofile.wav'
Channels : 1
Sample Rate : 8000
Precision : 16-bit
Duration : 00:00:04.16 = 33280 samples ~ 312 CDDA sectors
File Size : 6.82k
Bit Rate : 13.1k
Sample Encoding: GSM
Do you understand where the problem is?
Thanks
回答1:
from http://www.w3schools.com/html/html5_audio.asp
HTML Audio - Media Types
File Format
Media Type
MP3 audio/mpeg
Ogg audio/ogg
Wav audio/wav
if you dont have a GSM codec on your machine it will not work however, so you'll need to grab one mega Codec pack contains GSM 6.10 http://www.free-codecs.com/ACE_Mega_CoDecS_Pack_download.htm
来源:https://stackoverflow.com/questions/28766945/how-to-play-gsm-files-in-html5