Reputation: 11876
I am trying to create a simple audio player that will work in iOS for use with iPhone and iPad.
The audio is obtained from base64 encoded data (which I created using PHP base64 encoding function).
Here is my code below:
<audio controls="controls" autobuffer="autobuffer" autoplay="autoplay">
<source src="data:audio/ogg;base64,{my_base64_data}" />
</audio>
However, this works in Firefox, but it doesn't work in Safari.
Is there something I'm doing wrong?
Kindly assist.
Thanks.
Upvotes: 2
Views: 1858
Reputation: 11876
Ok, I managed to solve this.
I simply created an mp4 alternative to the ogg, encoded to base64, and added another source tag with the raw base64 data.
<audio controls="controls" autobuffer="autobuffer" autoplay="autoplay">
<source src="data:audio/mp4;base64,{my_base64_data_for_mp4}" />
<source src="data:audio/ogg;base64,{my_base64_data_for_ogg}" />
</audio>
Seems to be working without any issues so far.
Upvotes: 2
Reputation: 4287
I think safari doesn't do ogg at all. I might be wrong or tried a bad file, but i couldn't play ogg.
Upvotes: 2