Skip to content

Instantly share code, notes, and snippets.

@jbuda
Last active December 15, 2015 04:19
Show Gist options
  • Save jbuda/5201116 to your computer and use it in GitHub Desktop.
Save jbuda/5201116 to your computer and use it in GitHub Desktop.
YouTube API Controller Sencha touch
Ext.define 'youtube.controller.Videos'
extend:'Ext.app.Controller'
requires:[
'Ext.data.proxy.JsonP'
]
config:
refs:
videosList:'videoslist'
control:
videosList:
initialize:'onVideosListInitialize'
onVideosListInitialize:(target,event,options)->
this.getVideosList().setMasked({
xtype:'loadmask'
message:'Loading...'
})
Ext.data.JsonP.request({
scope:this
url:"http://gdata.youtube.com/feeds/api/users/barclaysfootballtv/uploads/"
params:
'v':2
'alt':'json'
success:(result,request)->
entries = result.feed.entry;
c = Ext.ModelManager.getModel("youtube.model.Video");
for entry in entries
u = Ext.create(c,{
title:entry.title.$t
thumbnail:entry.media$group.media$thumbnail[0].url
href:entry.link[0].href
})
Ext.getStore("Videos").add(u)
this.getVideosList().setMasked(false)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment