0.2 has come and gone and while I am still waiting on some more info for the manifest ticket…
The Instagram plugin is up and running!
The previous trouble I had with this plugin was solved with a Ctrl-A + Del of the existing code I had and starting over again! It really is true when your prof says to write code that you’re just going to throw away.
The code that I didn’t throw away is here:popcorn.instagram.js on github. The ticket is here.
I referenced the flickr plugin code when I re-wrote the code. What made me decide to look at flickr was that it’s also a plugin that relies on getting (a lot of) image data from a service and being able to display it to the user at the specific time it is requested. After looking through the code, I realized what I was doing wrong. I was retrieving the JSON data at the specified time of the video. This isn’t the ideal way to do this since getting a response from the api and loading images take some time to load. The best way was to have the images preloaded i.e. before it is requested in the video.
I’m fairly certain that it was because I was setting it up wrong – I had my setup code in the return statement of the plugin code. My setup code should be placed before the return statement. See below.
Popcorn.plugin( "instagram" , function( options ) {
//code goes here
return {
// Wrong, setup code doesn't go here if it needs to be preloaded
// _setup: function( options ){
// },
start: function( event,options){},
ends: function( event,options){},
_teardown:function( options ){}
}
});
My next step in this release is to update the ticket on lighthouse.
I’m glad that I took on this plugin. I’m hoping to improve it and maybe add the option for the user to specify a # of images to retrieve and maybe show it in a scrollable div. Another request that can be made to the api is searching for images with a specified tag. I’ll try and include these in the next release.
Thanks for reading! I appreciate any comments and suggestions!