How to play GSM files in HTML5

▼魔方 西西 提交于 2019-12-25 02:55:52

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!