如何在HTML5中播放GSM文件

问题描述:

我想在我的HTML5页面中播放GSM音频文件

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.

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?

谢谢

html / html5_audio.asp

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 

如果您的机器上没有GSM编解码器,它将无法正常工作,因此您需要获取一个
mega Codec包,其中包含GSM 6.10
http://www.free-codecs.com/ACE_Mega_CoDecS_Pack_download.htm

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