Tuesday 22 November 2011

Finally, my player is playing a slideshow



I finally managed to get a slideshow playing.  It took me damn near three weeks to do it but I finally manged to get it done.

The mistake I've been doing for the past few weeks had been trying to shoehorn the following swfobject statement into into my slideshow application.

swfobject.embedSWF("http://static.slidesharecdn.com/swf/ssplayer2.swf" ,"player","598","480","8",null,flashvarsabc,paramsabc, attsabc);

This was from the API documentation provided by slideshare here http://www.slideshare.net/developers/playerapi.  Unfortunately, it turns out that what I was supposed to have been using was the way the embedSWF was being invoked in the vimeo and youtube players, the only difference being that the player definition defined in the first parameter of the function call points to the slideshare player http://static.slidesharecdn.com/swf/ssplayer2.swf and instead of using clip_id: I would be using doc since the slideshow is a document not a video.

so my call to swfobject embed should have looked like this

     flashvars = {
        doc : vidId,
         show_portrait: 1,
        show_byline: 1,
        show_title: 1,
        js_api: 1,
           js_onLoad: 'Popcorn.slideshow.onLoad',
         js_swf_id: containerId
      };
      params = {
        allowscriptaccess: 'always',
        allowfullscreen: 'true',
        wmode: 'transparent'
      };
     
      alert("vidId " + vidId);
        swfobject.embedSWF( "http://static.slidesharecdn.com/swf/ssplayer2.swf", containerId, self.offsetWidth, self.offsetHeight, "9.0.0", "expressInstall.swf", flashvars, params, attributes );


In order to play a slideshow via a javascript, you cannot use the http uri to embed it but instead must use the doc id which can be obtained by going into slideshare, opening the slide you wish to embed and clicking on the embed options and then copying the line of code that lets you embed onto wordpress blogs.  See Screenshots below on how to do this



 So instead of the url of the slideshow you would enter a line similar to the one below


[slideshare id=602208&doc=thirst-1221628161155588-8]

The only snag I have right now is that my player, which really is just a modified version of the vimeo player, only works if a url is passed to it.   So the above line of code won't work but

http://www.slideshare.net/andrearsya/thirst-upload-800x600-1215534320518707-8-1864524

will work.  However as you can probably notice there is a significant difference between how the url and embed script versions identifies the slideshow.  To bypass this I'm passing a hybrid of the two that essentially puts the embed doc ID and combines it with an http url to slideshare like so:

http://www.slideshare.net/slideshow/thirst-1221628161155588-8

I'm not sure if this is acceptable or not and right now is serving as an interim solution to get the player to play a sldieshow  A better solution would be one that lets the user just copy the embed code like I specified in the above two slides, take the entire string (ie: slideshare id=602208&doc=thirst-1221628161155588-8) and pass the ID string at the end to parameter doc: in the params definition.   I'll need to talk with one of the popcorn developers on how to do this.


I'm hoping to be able to push this through sometime this week, next week at the latest.   There's still quite a bit that needs to get done.  Now that I've managed to get the slideshow playing I'll need to define the method that will let the user jump to a specific slide via popcorn.  I'll also need to clean up my code as well as define the unit tests.  Those items I'm planning to work on for my 0.4 release (although the version I would be pushing this week after cleaning the code up and doing some minor tweaks and fixes would technically really be a 01 release wouldn't it?)

Hopefully the stuff I've posted makes some sense,  it's 3AM as I post this and I'm starting to fade out.   Anyways, I'm just glad I finally managed to get this thing showing a slideshow.  I know I was supposed to be working on the mouselock functionality for firefox as well but after my instructor showed me how to properly run swfobject (apparently it has to be run via http:// and not from file:// like I've been doing for the past few weeks) everything began to come together and I just had to spend the past few days working on this thing.

Wednesday 16 November 2011

I've built it, now it's time to break it

...and modify it with the mousetracking stuff, provided I can figure out how to do it.  I'm probably the last one in my class to finally do it but I've finally managed to build firefox.  Huzzah!

   Now if only I could get the same level of success with getting my slideshow player running.

Monday 14 November 2011

Catching up with my blog posts

In all the chaos that's been going on I just realized that I've been missing posting my blogs for the past 2 weeks now.  Anyways, a quick recap of what's been happening since.

Over the break I looked into how slideshow implements slides and it is done by a flash embedder called swfObject.js.  At first I thought that this is what actually implements the slideshow and is what I should be editing to get the wrap the baseplayer features for the slideshow but after looking at the youtube and vimeo players and doing some tests and experimentation I later found out that this file just embeds the flashplayer that plays the slideshow.   In fact I don't even need this file as I can do what the other players are doing and call this .js file through "//ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"" using the popcorn.getScript method.

Now the snag that's been causing be grief for the past week and a half.  I still can't get it to run.  More specifically I seem to be getting a problem getting swfobjects to properly embed and play flash via a .js file.  Neither the youtube, vimeo nor my slideshow player are displaying their contents.  At first I thought that this might be due to me using an older none functioning version of the players, but after cloning again from the develop branch of the repo I'm still not getting any output from any of those players.   I suspect it could be a configuration issue on my laptop where I do most of my work but my lack of success in getting any of the players to also display their flash content on any of the school computers and my desktop at home undoubtedly means that I'll need to seek some clarification from either David or Chris on how to properly  run these players.

I'm sure there's more things that I've done and discovered with this player but I haven't had much sleep in the past few days and I'm drawing a blank right now, if anything comes up I'll add it in another blog post later this week.    I still need to do another recompile and debug of firefox which I'll be posting about sometime this week anyways.

One other thing I still need to do but ended up neglecting is my wiki.  For some silly reason I totally forgot that we had to create a wiki for this course, I'll be working on that if I get the chance tomorrow afternoon during the break in between my classes.  If not then then by the evening for sure as well as do an update of the ticket for the slideshow player.

Thursday 10 November 2011

Couldn't successfully build Firefox


My attempt to build firefox took me around 8hrs, the bulk of it spent downloading all the materials from mozilla's Mercurial repository and the actual installation itself.   Judging from the error message it appears that the installation failed due to it missing a couple of files.  I'm not sure though if this was due to an incomplete or erroneous download of the repository or caused by an error with the build itself.  I do suspect the former as I did mistakenly stop the download earlier due to it taking so long that I thought that the download had hanged.

I'll make another attempt tomorrow evening starting with a redownload of the repo and try to figure out what went wrong.