Created
February 11, 2013 22:26
-
-
Save mitchellsimoens/4758205 to your computer and use it in GitHub Desktop.
ST2 Youtube Component
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ext.define('Ux.YouTubePlayer', { | |
extend : 'Ext.Component', | |
xtype : 'youtubeplayer', | |
config : { | |
url : 'http://www.youtube.com/embed/', | |
videoId : null | |
}, | |
getElementConfig : function() { | |
var tpl = this.callParent(); | |
//The src will come from the updateVideoId method | |
tpl.children.push({ | |
tag : 'iframe', | |
reference : 'videoIframe', | |
//would rather this be in CSS | |
style : 'width:100%;height:100%;border:0;' | |
}); | |
return tpl; | |
}, | |
updateVideoId : function(videoId) { | |
if (videoId) { | |
this.videoIframe.set({ | |
src : this.getUrl() + videoId | |
}); | |
} | |
} | |
}); | |
Ext.application({ | |
name : 'Test', | |
launch : function () { | |
Ext.Viewport.add({ | |
xtype : 'youtubeplayer', | |
videoId : 'qsvpvqvApKo' | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment