Home > english, Programming > An example how to use the VIMEO Moogaloop Javascript API

An example how to use the VIMEO Moogaloop Javascript API

August 19th, 2009 Leave a comment Go to comments

Last time I worked a little with the Moogaloop JavaScript API, because I thought it would be a nice workaround solution for integrate the Moogaloop API in an Adobe AIR Application. First time I tried the example code from the vimeo api documentation and it worked fine on my webserver. But for my case I did not want to use the SWIFF JavaScript Code. Only the SWFObject Code for embedding Flash Content in HTML was for me o.k. So I spent a few hours to get this API work without this SWIFF JavaScript thing. I tried a lot, failed a lot, cried a lot and laughed a lot about myself and my limited JavaScript knowledge. So now I am happy with my current version, because it works fine without this SWIFF thing, except loading a new Video (or should I say loading a new clipID) into this SWF Container failed. So if anyone has an idea, please post a comment here!

Download SWFObject  Code Example

  1. Jaimon Mathew
    December 19th, 2009 at 15:16 | #1

    Hi,

    First of all a big thanks for posting this. I also needed the same functionality and the sample from vimeo’s website wasn’t working at all. I’ve managed to get new clips loading, so I thought I’ll share that with you. When the video is first loaded, somehow the element “myContent” disappears from the DOM tree, so the second call to SWFObject fails. Solution?, create “myContent” if it doesn’t exists.

    first add a container div on top of myContent like,

    …..

    Then when loading the second clip before calling swfobject.embedSWF, add these lines,

    var vp=document.getElementById(‘myContent’);
    if(!vp) {
    var container=document.getElementById(‘myContentContainer’);
    container.innerHTML=”;
    vp=document.createElement(‘DIV’);
    vp.id=’myContent’;
    container.appendChild(vp);
    }
    swfobject.embedSWF(“http://www.vimeo.com/moogaloop.swf”,’myContent’….

    HTH

    Jaimon

  2. admin
    December 19th, 2009 at 17:39 | #2

    Hi Jaimon,

    I know this problem… And I am still have it 🙁 I don’t know a solution and JavaScript is not really my cup of tea. Sorry. Hopefully some of my bolg readers know a good solution…

    Best regards,
    Flo

  3. Jaimon Mathew
    December 21st, 2009 at 12:47 | #3

    Hi Flo, may be I wasn’t clear on my first post. As I mentioned there, I did manage to get new clips playing. You can see the source code for a fully working example at http://docs.google.com/Doc?docid=0ASBiQVsuhHGlZDRrd2Z4Zl8xZG03OWt4ZHA&hl=en

    HTH

    Jaimon

  4. admin
    December 21st, 2009 at 13:25 | #4

    Uh yeah Jaimon. You were clear! I read to fast your comment and answered to fast… Thanks a lot for your solution. It also works fine on my server! 🙂 Thanks!!

    Maybe I will rewrite my Air Vimeo Component now 🙂

  5. ben
    February 10th, 2011 at 13:26 | #5

    hey thanks… your example works ! Saying this because the ones provided by vimeo itself don’t. #shame on ’em (; !

  6. siva
    September 13th, 2014 at 07:31 | #6

    Hi sir, I’m embedding videos from vimeo, the swfobject solved my problem with contextMenu of flash player. But the flash player is not showing up on firefox browser. I have installed the flash player by following the url you have mentioned in this example. Please help. Thanks

  7. admin
    September 17th, 2014 at 18:30 | #7

    Hello Siva,

    Sorry, I can’t really help you and vimeo also killed the moogaloop API. So I am sure it is not a good idea anymore to use my code… Have a look at the developer vimep site for get an overview of the new APIs https://developer.vimeo.com/apis/

    Good luck and all the best
    Florian

  1. March 2nd, 2010 at 14:04 | #1