HTML5 tag cannot play audio file in ios chrome and safari

I am trying to get a simple sound reproduction. I have a list of tracks, each at a unique URL that I would like to play when the user clicks the corresponding play button. I tried using soundmanager2 and jplayer but could not get it to work for my use case (desktop browser and ios). I returned to html5 directly with the code as follows

<audio controls>
      <source src="/path/to/file" type="audio/wav">
    Your browser does not support the audio element.
</audio>

This works great on desktop chrome and desktop safaris. In ios chrome and ios safari (the last), the player is not represented, but instead a message appears in the gray box that says: "Unable to play audio file."

Am I using this tag correctly? How can I overcome these mistakes?

Update 1

I am sending a wav file from google appengine (like blob). I found that safari cannot play unless I add .wav to the end of src - even though src is just an indirect link to the file. The actual returned file terminates in .wav, but Safari is not smart enough to recognize this.

Update 2

All browsers (mentioned above) do the following: this does not apply to wav files.

<audio controls preload="metadata">
      <source src="http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/Samples/AFsp/M1F1-Alaw-AFsp.wav" type="audio/wav">
    Your browser does not support the audio element.
</audio>

I sent the file from the Google engine as a MIME attachment and raw response, but that doesn't make any difference.

Update 3

I swapped a longer wav file ( http://www.villagegeek.com/downloads/webwavs/ever_again.wav ) and this also cannot play (on ios). It is unclear due to length, size, or some other variable.

Update 4

I ruled out that size is a problem because this 24 watt file works

<audio controls preload="auto">
      <source src="http://www.dailywav.com/sites/default/files/wavs/dontlikelaughing.wav" type="audio/wav">
    Your browser does not support the audio element.
</audio>

5

, Google. MIME, / . , , .

+4
1

, Google. MIME, / . , , . , , MIME GCS.

+2

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


All Articles