I am playing an audio track in sencha touch. Its working fine.. But I want two things.
1) How to hide audio player and autoplay the sound. For this I tried
autoplay:true, and
hidden:true,
But this is not working ..
2) I want to add a button for sake of playing audio i.e. It contains the text “Tap to Play”
and when it is tapped it turns Pause .. And when pause tapped it turns to Play ..
I have done this but It does not Work well at all.. i.e. first i have to tap play button at the player and then My customize button came into action ..
Kindly help me to get out of this ..
{
xtype: 'audio',
url: 'lib/touch/snd/sound.mp3',
id: 'sound1',
autoplay:true,
hidden:true
},
{
xtype: 'button',
text:'Tap to play audio',
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');
}
}
Please refer to documentation…
link
It should be something like this