我是sencha的新手,我正在尝试将音频播放器添加到我的应用中,其中音频的网址是外部链接。这是我用过的代码
{
xtype:'audio',
url:'http://dl.enjoypur.vc/upload_file/5570/6757/%20Bollywood%20Hindi%20Mp3%20Songs%202015/Prem%20Ratan%20Dhan%20Payo%20(2015)%20Mp3%20Songs/02%20Prem%20Ratan%20Dhan%20Payo%20%28Title%20Song%29%20Palak%20Muchhal%20-%20190Kbps.mp3',
title:'Sample MP3',
thumb:'media/sample.jpg'
},
应用程序向我展示了一个视频中的音频播放器,但这只是没有响应而且没有播放。有没有办法从外部链接插入音频?
提前致谢
答案 0 :(得分:2)
如果您在问题中共享更多代码以找到错误,那将非常有用。这对我有用:
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 : 'http://dl.enjoypur.vc/upload_file/5570/6757/%20Bollywood%20Hindi%20Mp3%20Songs%202015/Prem%20Ratan%20Dhan%20Payo%20(2015)%20Mp3%20Songs/02%20Prem%20Ratan%20Dhan%20Payo%20%28Title%20Song%29%20Palak%20Muchhal%20-%20190Kbps.mp3'
}]
});
另外,我强烈建议您使用示例触摸documentation 在fiddle内测试。很不错的音乐。我喜欢这种东方式的音乐。我希望它可以帮助你: - )