I heard that Android devices do not play some audio files in html5 (for example they support mp3 but do not play files created with help of some standart soft: the link).
I tried different variants, but no one worked for me.
E.g. the standart example from here:
Ext.create('Ext.Container', {
fullscreen: true,
layout: {
type: 'vbox',
pack: 'center'
},
items: [
{
xtype : 'toolbar',
docked: 'top',
title : 'Ext.Audio'
},
{
xtype: 'toolbar',
docked: 'bottom',
defaults: {
xtype: 'button',
handler: function() {
var container = this.getParent().getParent(),
// use ComponentQuery to get the audio component (using its xtype)
audio = container.down('audio');
audio.toggle();
this.setText(audio.isPlaying() ? 'Pause' : 'Play');
}
},
items: [
{ text: 'Play', flex: 1 }
]
},
{
html: 'Hidden audio!',
styleHtmlContent: true
},
{
xtype : 'audio',
hidden: true,
url : 'touch/examples/audio/crash.mp3'
}
]
});
And audio in html:
<audio controls>
<source src="resources/sound/1.mp3" type="audio/mpeg">
Can't play sound on your device.
</audio>
When I debug my application with help of the Chrome browser I hear the sound, but I do not hear it on a real device (Android 2.3.5).
In case of the html variant I see that a slider twitches and immediately stay at the end of a progress bar. In case of the ‘play’ button everything works normally (graphics, play/pause) except the sound that is missing.
I did not find any special Android permission option for sound, so, I think the permissions are not the reason.
The question. Am I wrong and is it possible to play any mp3 audio? What is the easiest work around?
Sencha Touch Audio only works in the Android / Chrome browser, not on the device. One solution is to wrap your app with Phonegap and use the Media object for audio. A lot of bother but mostly it works.