使用外部 url 在 Sencha 应用中播放音频
Play Audio in Sencha app with external url
我是 sencha 的新手,我正在尝试将音频播放器添加到我的应用程序,其中音频的 url 是一个外部 link。这是我使用的代码
{
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'
},
应用程序向我显示了一个音频播放器,但它没有响应,也没有播放。有没有办法从外部插入音频 link?
提前致谢
如果您在 matter 中分享更多代码以查找错误,那将非常有帮助。嗯,这对我有用:
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'
}]
});
此外,我强烈推荐带有示例的 Touch documentation
在 fiddle 内测试。很不错的音乐。我喜欢这种东方风格的音乐。希望对您有所帮助:-)
我是 sencha 的新手,我正在尝试将音频播放器添加到我的应用程序,其中音频的 url 是一个外部 link。这是我使用的代码
{
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'
},
应用程序向我显示了一个音频播放器,但它没有响应,也没有播放。有没有办法从外部插入音频 link?
提前致谢
如果您在 matter 中分享更多代码以查找错误,那将非常有帮助。嗯,这对我有用:
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'
}]
});
此外,我强烈推荐带有示例的 Touch documentation 在 fiddle 内测试。很不错的音乐。我喜欢这种东方风格的音乐。希望对您有所帮助:-)