Study – The Video Players of Social Networks (YouTube, DailyMotion, Veoh, Vimeo, GoogleVideo, Flickr)

3 as3,flash,flv encoding,work,youtube  |   July 3, 2009  |     1739

Hi Everyone,

I am doing research on which video player I can easily embed inside of an AS3 application. I had these players in mind: DailyMotion, Vimeo, Veoh, Youtube, GoogleVideo, and the DivShare player as a fallback. Right of the bat, the following players are still in AS2:

  • YouTube
  • DailyMotion
  • DivShare
  • GoogleVideo

While these are in AS3:

  • Vimeo
  • Veoh
  • Flickr


AS2 PLAYERS
The big disadvantage with AS2 players is you cannot interact with them directly from AS3. When AS2 swf files are loaded into a Loader object, they become an AVM1Movie, on which you cannot control much. This is a fundamental problem to start with. However each player had even more reasons to keep my interest away; they are listed below.

YouTube Player
There are tricks out there, using a LocalConnection, that enable you to wrap the YouTube player into another AS2 file, which acts as a bridge to AS3 by opening a LocalConnection between the two; but honestly, this is a wonky workaround. It doesn’t work locally in your test environment, you need to run it in the browser, plus there are security sandbox issues since YouTube’s crossdomain.xml file will not open the door for you. For me this kills it, YouTube is out.

DailyMotion Player
The DailyMotion player runs great inside of a AS3 project, except for one detail: it will always resize to the full Stage size. I don’t know who wrote that code, but it is laughable. You can position the AVM1Movie to take any position you want in your flash movie, however you will not be able to control it’s size (unless someone can tell me how?). This is not acceptable in the context where I want to show a videos on a GoogleMap, hence DailyMotion is dropped.

DivShare Player
The DivShare player uses the same logic as the DailyMotion player, it will resize to full stage size on it’s own. This is a no go. DivShare player is dropped.

GoogleVideo Player
I haven’t fully tested the GoogleVideo player since there is no easy functionality on GoogleVideo to embed it’s player even in HTML. GoogleVideo seems to be more geared towards searching, and if I can’t embed the player easily, I cannot do it inside of an AS3 application. So GoogleVideo was dropped alse.

AS3 PLAYERS

Veoh Player
The Veoh player will not run properly inside of an AS3 application. On the output window you see: TypeError: Error #1009: Cannot access a property or method of a null object reference.
at WebPlayer()
. I decompiled their player using the nice SoThink SWF Decompiler, and saw that in the constructor of the Veoh player they do the following:

Basically they are trying to access the stage right away, which will be null until I add this class to the DisplayList, hence, it is a no go. Veoh had to be dropped also. Too bad they call “createCustomMenu” after their manipulation of the stage.

Vimeo Player
This one is my favorite. Although after decompilation I noticed it isn’t exactly well engineered, it works great, is simple, and you can play 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 of the fullscreen button, and I was successfull. Here is a sample code of how I do it:

Basically, once the player is loaded, I run a timer that waits until the sidedock object is created, and at this point I call api_toggleElement to remove the elements I do not want. I got the string constants by decompiling the player, so those constants that you see there are basically all that is available from my research; all the elements you can toggle. Now all you need is to extract the clip ID from the video page’s permalink, which is done this way:

The Vimeo Player is therefore usable and fun to play with :)). Plus it is pretty.

Flickr Player
The Flickr Player is a good one too. You need to know the photo_id and photo_secret to use in this url:
http://www.flickr.com/apps/video/stewart.swf?v=49235&photo_id=2345938910&photo_secret=846d9c1be9
However that is easy to do with the Flickr API. The Flickr API clearly states that it is meant for non-commercial use.. so. well.. that limits the playground. This player also has the bad habit of resizing to the stage dimensions, but after decompiling I noticed that I can call the function setSize on it, which will make it behave. From my observation of the code behind this player, it is over-engineered. This is an opinion… but I basically would need documentation to understand it, and to me that is not a sign of clean, good code.

Here is the code:

CONCLUSION
If you want to use one of the social networks as an engine to store videos in an application that is written in flash for the front-end, your options are not easy. YouTube has the best API in the business, however using their player is a f*cking pain. Vimeo has the best player, but their API is limited. You can cheat YouTube with the little KeepVid client I wrote, but how long will KeepVid.com be alive for?

I opted to use DivShare, found a way around their player. DivShare will resize all the videos to 560×420 however, no matter what the proportions are on your original video. It will convert AVI & MPG to FLV for you on the fly, it has a nice .NET client and PHP client for the back-end. So the integration can be seamless with your system IF you are ok with them resizing the videos to 560×420.

I will blog about the details of that later.

Cheers!

Martin

Comments
  • July 3, 2009 at 5:47 am

    XkiD | 07.03Study - The Video Players of Social Networks (YouTube, DailyMotion, Veoh, Vimeo, GoogleVideo, Flickr) | blog.xkid.ro

    […] rest is here:  07.03Study – The Video Players of Social Networks (YouTube, DailyMotion, Veoh, Vimeo, GoogleVideo, F… Posted in PHP | Tags: and-the, are-loaded, daily, doing-research, everyone, had-these, […]

  • July 3, 2009 at 6:26 am

    intense creativity » Study – The Video Players of Social Networks … - Cheat Codes

    […] tripwiremag wrote an interesting post today onHere’s a quick excerptI don’t know who wrote that code, but it is laughable. You can position the AVM1Movie to take any position you want in your flash movie, however you will not be able to control it’s size (unless someone can tell me how?). … I haven’t fully tested the GoogleVideo player since there is no easy functionality on GoogleVideo to embed it’s player even in HTML. GoogleVideo seems to be more geared towards searching, and if I can’t embed the player easily, I cannot do it inside … […]

  • July 28, 2009 at 5:57 am

    flv player

    Thanks for given this useful post…

Leave a Reply