【发布时间】:2014-06-09 20:52:40
【问题描述】:
我希望每次在轮播中显示新面板时播放一个小型 mp3。我将音频 xtype 与自动播放一起使用,但这会导致启动时出现杂音。该问题出现在所有设备(模拟器、Chrome、ipad 和 nexus7)上。现在,我使用一个按钮来激活声音,但我希望它在需要时自动播放(在活动面板上)。它“听起来”很简单,但我无法让它工作。任何帮助表示赞赏。
这是一个轮播项目(带有按钮):
{
layout: {
type: 'vbox',
align: 'stretch',
},
items: [
{
flex:4,
xtype: 'image',
src: 'resources/images/hond.png',
},
{
xtype: 'button',
text: 'Play',
iconCls: 'arrow_right',
cls: 'knopsound',
handler: function() {
Ext.getCmp('hond').toggle();
this.setText(Ext.getCmp('hond').isPlaying() ? 'Pause' : 'Play');
}
},
{
xtype: 'audio',
url: 'resources/images/hond.mp3',
id: 'hond',
loop: false,
enableControls: false,
hidden:true
},
{
flex:3,
xtype: 'video',
url: 'resources/images/test.mp4',
posterUrl: 'resources/images/bekijkgebaar.png',
cls: 'videoplayknop',
autoResume: true,
autoPause: true,
enableControls: false,
}]},
【问题讨论】:
标签: extjs sencha-touch-2 html5-audio