Available Plugins
Sharing plugin
This plugin adds sharing functionalities to the player. Either through the dock or through the controlbar, the plugin offers links to two screens:
- In the embed screen, an embed code for the specific video can be copy-pasted.
- In the share screen, a link to thesite for this specific video can be copy-pasted. This screen also offers shortcuts for posting this link to:
This plugin is compatible with version 4.3 of the player, since it needs to be able to place buttons in the controlbar. For 4.5+, the plugin can also place the buttons in the dock (preferred, since the buttons are clearer). If the dock is set to false, the button will be shown in the controlbar again.
Examples
Here is an example of the sharing plugin in action. Below is the string of flashvars used:
/player/testing/files/bunny.mp4&plugins=sharing&sharing.link=http://bigbuckbunny.org/index.php/trailer-page/&sharing.code=%3Cembed%20src%3D%22http%3A%2F%2Fdeveloper.longtailvideo.com%2Fplayer%2Ftrunk%2Fas3%2Fplayer.swf%22%20flashvars%3D%22file%3D..%2Ftesting%2Ffiles%2Fbunny.mp4%22%20width%3D%22400%22%20height%3D%22300%22%20%2F%3E
Note that the code is fairly lengthy, since a full embed code needs to be set. See below embed section for a workaround.
Here is another example, this time using the controlbar instead of the dock and only the share feature:
file=/player/testing/files/bunny.mp4&plugins=sharing&sharing.link=http://bigbuckbunny.org
Configuration
The plugin is loaded with the flashvar plugins=sharing. This will automatically load the latest version of the plugin straight off our servers. It offers two additional flashvars:
- sharing.code (undefined): Set this flashvar to an embed code for this video. When set, the embed button is shown. Be warned that this embed code must be URI escaped or the code will break the other flashvars of the player. Here's info and a tool on URI escaping.
- sharing.link (undefined): Set this flashvar to the url of a webpage where the video is shown. When set, the share button will appear.
If the regular link flasvar has been set instead of the sharing.link flashvar, the plugin will still show the share dialog, of course using the link flashvar. You can prevent this by setting the sharing.link flashvar to none.
If the title flashvar has also been set, the plugin uses that as subject for the sharing links.
When the flashvar dock=true is set (for the 4.5+ player), the buttons are displayed in the dock. When this flashvar isn't set, or the player is pre-4.5, the buttons are displayed in the controlbar.
There is no support for per-playlistentry embed / link codes. So if you use a playlist, the same codes will appear with every item. Additionally, only the link / title flashvars are supported for the sharing screens, not the link / title vars of playlist entries.
Embed
There's a lot of different options available for the embed code. For example, you could offer javascript, iframes, embed tags, object tags or embed-in-object tags to your visitors in this code. To keep the code short and simple, we recommend the simple, regular embed code. Here's an example:
<embed src="http://developer.longtailvideo.com/player/trunk/as3/player.swf" flashvars="file=/player/testing/files/bunny.mp4" width="400" height="300" />
The URI escaped value of this embed code (for the sharing.code flashvar):
%3Cembed%20src%3D%22http%3A%2F%2Fdeveloper.longtailvideo.com%2Fplayer%2Ftrunk%2Fas3%2Fplayer.swf%22%20flashvars%3D%22file%3D%2Fplayer%2Ftesting%2Ffiles%2Fbunny.mp4%22%20width%3D%22400%22%20height%3D%22300%22%20%2F%3E
This code may still get very lenghty when a lot of flashvars are being used. There is a workaround for this: rewriting the player URL serverside to inject the flashvars. This is something we do at Bits on the Run too. For example, you could save the player with flashvars in your database and then offer a unique player URL for each setup in the embed code:
<embed src="http://developer.longtailvideo.com/players/8238592.swf" width="400" height="300" />
Now, the server will get a request for the file players/8238592.swf. It can extract the ID from this request, do a lookup in the database and then rewrite this request to the following file:
/player/trunk/as3/player.swf?file=/player/testing/files/bunny.mp4
Now the player.swf is being loaded. The flashvars (querystring) are loaded into the player too, without them needing to be printed in the embed code.
Source code
The source code of this plugin can be obtained in a zip (click the zip links at the bottom) or through Subversion:
svn co http://developer.longtailvideo.com/svn/plugins/sharing
If you don't have a Subversion client, check out Tortoise (Windows) or SC Plugin (MAC).
You don't need Adobe Flash to modify this plugin. Instead, you can edit the plugin with any text editor you like. The plugin can be compiled with the free, cross-platform MXMLC compiler. See our plugin compiling overview for more info.
