Internet Explorer 6 is not supported.
Upgrade to view this site.

Vimeo Player and the Secret API

Posted on May 25, 2009 at 5:00 pm

I am working on a project that is going to have an API that allows the user to insert video. The API is basically an ActionScript class that attaches a property when the user publishes their SWF. When the SWF is loaded into the main SWF program, it has access to the special functions in the SWF file. First, I just used the FLVPlayback and a registry function so the app would have access to it’s functions. That’s fine, but the user has to host an FLV for this to be effective. Not everyone has a server at their disposal, so this is the reason to build on existing video sites. Also, your not shit as a dev guy unless your mashable Web 2.0 savvy.

Fortunately, the popular sites have APIs out there ready and available to get content and media. A developer is expected to know what they have available to them and what will make the job easier for them. Being in the know about Facebook shit is actually a job requirement.

So, first one I thought of was the giant, YouTube. YouTube’s player is AS2 and to use it in an AS3 project you need to wrap it in an AS3 SWF and use LocalConnection to interface with it. There are a few solutions out there but in the end it is a band aid, until YouTube puts together an alternative player API. After fumbling with this, and saving the failing code to my repository for later, I went to Vimeo.

Vimeo has a pretty cool player and the thing that puts it over the top for my app is that it is written in ActionScript 3. But, as with everything, it isn’t perfect. YouTube has a good API page, and some decent forums, and support of the widespread dev community. Vimeo does not. Their API page is nothing short of pathetic, to say the least. They have one example and it doesn’t work. I found a working example on their fourm. At the top of the API page (as of this posting) they have a blurb that says this: You may have noticed that there are some inaccuracies in this documentation. We working on improving it. How about now? In the time it took to put up that asinine message you could of updated the code. That is annoying. Also, there is no public functions to be seen what so ever. Searching on the forums, someone found play, load and unload, which kind of works like stop. I also needed an event at the end of the video. Pretty standard stuff as far as a video API goes. Looks like I am going to have to Sherlock Holmes this shit.

There are some API functions exposed that I found by debugging the player. Use these at your own risk as they are not documented and may change. The way I figure it as soon there is an update to the player changing the functions to the real deal functions is no biggie. For the here and now I need ways to respond to the end of a video, play, pause and stop.

It seems that all the API commands are prefaced with api_ before the function name. Below are a list of functions that seem to be exposed for API usage. I have not tested all of them, but for what it’s worth here is a list. Some need parameters to work and my debugger isn’t specific about the datatype for these. So, here are the method signatures as far as I can tell. The debugger shows the wildcard (*) for datatypes that are not top level, so it could be anything specific to the Vimeo player. Really unknown unknowns are marked with a question mark.

function api_changeColor(?):?
function api_changeOutro(one:String, two:*):void
function api_disableHDEmbed():void
function api_enableHDEmbed():*
function api_isLoaded():Boolean
function api_isPaused():Boolean
function api_isPlaying():Boolean
function api_likeClip():void
function api_loadVideo(one:int):void
function api_pause():*
function api_play():*
function api_seekTo(?):?
function api_setOnFinishCallback(one:String):void
function api_setOnPauseCallback(one:String):void
function api_setOnProgressCallback(one:String):void
function api_setSize(one:int, two:int):void
function api_toggleElement(one:String, two:*):*
function api_toggleFullscreen():void
function api_toggleLoop():void
function api_togglePlayPause(one:Boolean):void
function api_unload():void
function api_unload_other_players():*

For the api_setOn functions, they are callbacks for JavaScript, which means you will need a JavaScript function named the same as the parameter you pass in. Remember to set your HTML page param allowScriptAccess to always as this is coming from the Vimeo site otherwise you will get a SecurityError. I hope when they do get out the official API they will have an ActionScript event to respond to so I don’t have to shoot back and forth between AS and JS to do a simple thing like get the end of a video.


Adam Lane

Thanks heaps Robert, great bandaid.
Vimeo have to pick up the slack pretty soon in my mind

Posted May 28, 2009 at 12:20 am
Denis Ivanov

An example would be bang up!

Posted May 30, 2009 at 12:38 pm
Robert Abramski

Denis, in the post there is a link to a working example that idFlood posted in the Vimeo forums. It’s where I got the idea to look deeper into what the player was capable of. He uses some of the API calls in his code. So, take a look at this. It is a good place to start.

Posted May 30, 2009 at 7:18 pm

intense creativity » Study - The Video Players of Social Networks (YouTube, DailyMotion, Veoh, Vimeo, GoogleVideo, Flickr)

[...] with it with a few api functions that are not documented. For a list of those functions refer to this post. I wanted to hide a few features, well, most of the features on the right hand side, plus get rid [...]
Stefan Dosch

thanks for sharing! I still dont understand, why vimeo doensnt officially document their api though…

Posted July 8, 2009 at 2:33 pm
Robert Abramski

Stefan, I think they put a lot of time into their data APIs which is holding the Moogaloop API back. It is frustrating, especially when the API is already there just below the surface.

Posted July 8, 2009 at 4:33 pm
Stefan Dosch

I also found out, the integration of the Moogaloop player into a flash file is buggy, once you place the player anywhere else than x:0/y:0 on stage: the activation rectangle showing the player interface (once you roll over while playback) will always stay fixed to 0:0.

Posted July 9, 2009 at 2:34 am
Robert Abramski

Stefan, that does explain why the rollover doesn’t seem to work all the time. I thought that it might be something on my end. I believe I read about that bug in one of the Vimeo forums, but I didn’t make the connection until now. I’m not working on the video API for my project right now, but if I find a way to fix this in the future I’ll write a post about it. Feel free to tell me about it if you find a solution first!

Posted July 9, 2009 at 9:51 am
Brad Dougherty

Just wanted to let everyone know that we are officially offering the Moogaloop API now.

Posted July 15, 2009 at 9:46 am
Robert Abramski

Thanks for the update Brad, but this doesn’t really apply to my post. Vimeo has indeed updated their API, but Vimeo only released the JavaScript API officially. The ActionScript API is still shrouded in the shadows. In Vimeo’s documentation, JS API is now top billing and AS API still has that ominous reminder that some of the documentation is not accurate. I did a short test (I will do some more later) to see if the AS API is still intact and it seems that the information above is still accurate. I’m glad to see that there is some motion on the Moogaloop front and I anxiously await the official release of the ActionScript API.

Posted July 17, 2009 at 3:24 pm

I have the same problem with the hit test zone, stuck in the top left of my swf. They seem to use the stage mouse position (not the parent container mouse position or the classics MouseOver/MouseOut events) …
If someone have a solution please post it here !

Posted July 26, 2009 at 11:59 am

I tried to use the Moogaloop SWF in an AIR application but unfortunately I got a Security Error. The command Security.allowDomain(“”); doesn’t work in an Air App. Do you or anybody know a workaround for this?

Thanks a lot!

Posted August 1, 2009 at 7:29 am
Casey Pugh

We officially added AS API, but we’re still working on fully documenting it. The example class should provide a good start:

Posted August 10, 2009 at 3:54 pm
Robert Abramski

This is great news, Casey! I see there are some API calls in the example that I found, so I guess the function names won’t be changing in the future. That is a relief. Thanks to the whole Vimeo team for keeping me informed.

Posted August 10, 2009 at 4:31 pm

Working with Vimeo Moogaloop API in Flash | der hess

[...] The last weeks I dealt with the vimeo Moogaloop API. The documentation on the JavaScript and Flash API was not so well. But fortunately a couple days ago they updated the documentation for the JavaScript API and then for the Flash API. So now I am able to give an introduction how you can use the Moogaloop API in Flash. The guys from vimeo published a Videowrapper Class which handles the very very basic stuff of the vimeo video player. So you can easily import the vimeo video player in your Flash Projects and you are able to do basic functionality like play(), pause() and loading a new video. But if you wanted to create your own video player, this wrapper class doesnot go too far. So I did some analysis on the moogaloop.swf File and found some interesting functions, that solves some of the problems, which Robert Abramski described in his Blog post Vimeo Player and the Secret API. [...]
Florian Weil

I also worked with this Flash moogaloop API and I extended the vimeo Flash Class in the documentation. You can see my results on my blog:

Posted September 1, 2009 at 2:25 am
matteo sisti sette

The AS api is tremendously buggy. That may explain why they don’t release it: 90% of the things they would have to document actually don’t work.

Posted October 4, 2009 at 5:38 am

Does anyone know how to specify password in password protected embedded Vimeo videos? I know the password and providing it on web page next to player, but this is boring for users to type it on keyboard. Should i create custom Vimeo player for this? Is it possible at all?

Posted September 26, 2010 at 2:35 pm
codigo descuento

Thanks for the info mate!

Posted December 16, 2011 at 10:18 am

Leave a Comment

*Required fields. Email will not be published.