Play an audio file of any format in any browser

I record sound on different mobile phones, and each saves the file in a different format, for example

.m4a, .3ga, .amr

. The problem I am facing is how to play such audio files in any browser.

<audio controls height="100" width="100"> <source src="myfile.mp3" type="audio/mpeg"> <source src="myfile.ogg" type="audio/ogg"> <embed height="50" width="100" src="myfile.mp3"> </audio> 

I tried the above code, but not useful. because I can’t apply the code for .m4a, .3ga and .amr.

Phone records will not necessarily be in mp3 files

Any other approach I need to take?

Any suggestions? You are welcome,

+4
source share
2 answers

Sorry to bring you bad news, but you cannot reproduce any file format in the <audio> HTML5 element.
Instead, you can choose from a list of valid audio formats, as indicated here: https://developer.mozilla.org/en-US/docs/Web/HTML/Supported_media_formats

Acceptable formats soon:
1. WebM
2. Ogg
3. Mp3
4. AAC
5. WAV

In your case, if you want to play any audio format that is not supported by the HTML5 specification, you will have to solve it in the same way that audio files were played before HTML5 using Plugins .
You can find many audio browser plugins on the Internet for each type of file.

+1
source

Use this link and you can play most of the sound using HTML5

http://www.w3schools.com/html/html5_audio.asp

+1
source

Source: https://habr.com/ru/post/1498309/


All Articles