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.

No comments:

Post a Comment