【发布时间】:2012-11-21 07:36:29
【问题描述】:
我正在用 sencha touch 播放音轨。它工作正常..但我想要两件事。
1) 如何隐藏音频播放器并自动播放声音。为此我尝试了
autoplay:true, and
hidden:true,
但这不起作用..
2) 我想添加一个按钮来播放音频,即它包含文本“点击播放” 当它被点击时它变成暂停.. 当暂停点击它变成播放.. 我已经这样做了,但它根本不能正常工作..即首先我必须点击播放器上的播放按钮,然后我的自定义按钮开始起作用.. 请帮助我摆脱困境..
{
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');
}
}
【问题讨论】:
-
请不要再编辑了,请尝试给我一个解决方案
标签: audio sencha-touch touch sencha-touch-2