当我转到其他页面时,如何停止或暂停播放YouTube视频
在Sencha Touch2中这是我的代码似乎它应该可以工作但视频仍在播放。
Ext.define('MyApp.view.tablet.Home5', {
extend: 'Ext.Panel',
xtype: 'home5',
config: {
scrollable: true,
cls:'logo',
items:[
{
xtype: 'panel',
id: 'videopanel',
html:[
'<div id="video1"><iframe width="560" height="315" src="http://www.youtube.com/embed/NSUucup09Hc?fs=1&hl=en_US&rel=0&autoplay=0" frameborder="0" allowfullscreen></iframe></div>',
'<img src="resources/images/thapelo3Fy.jpg" />'
].join("")
}
]
},
hide: function(container, options){
this.callParent(arguments);
//workaround to stop the video (= reset the html)
Ext.getCmp('videopanel').setHtml("");
Ext.getCmp('videopanel').setHtml('<div id="video1"><iframe width="560" height="315" src="http://www.youtube.com/embed/NSUucup09Hc?fs=1&hl=en_US&rel=0&autoplay=0" frameborder="0" allowfullscreen></iframe></div><img src="resources/images/thapelo3Fy.jpg" />');
}
});