Extension:FramedVideo

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual - list
Crystal Clear action run.png
FramedVideo

Release status: stable

Implementation Tag
Description Allows embedding videos from various services
Author(s) Ruiztalk
Latest version 1.1.2 (2009-04-07)
MediaWiki fully tested on 1.11.0 and 1.13.x, should work on 1.8+; PHP 5 is required
License GPL
Download trunk or from ftp
Example few examples including error handling; you can use sandbox for testing

Translate the FramedVideo extension if possible

Check usage and version matrix; code metrics

FramedVideo extension allows embedding videos from 44 video hosting services.

FramedVideo is based on Video Flash extension by Alberto Sarullo, which is based on YouTube extension by Iubito.

Note for real programmers: This extensions has a really ugly code. It's author is not a PHP programmer but just a guy who really needs this extensions for his website. But hey, this extension works.

Note: Please upgrade to the newest version and keep eye on changes!

What can this extension do?[edit | edit source]

  • Handle videos from 44 video hosting services.
  • Put them into frames that MediaWiki uses by default to show images.
  • Provide wikitext-supporting description below videos.
  • Scale all video (default width and height values are stored in the extension core).
  • Set some global variables for configuration around the whole wiki.
  • Handle all errors user may cause.

What this extension can't do?[edit | edit source]

  • Validate values of id parameter. Videos just won't be loaded if a video id is not valid. A few services show some error messages for invalid id's, most do not.

Download instructions[edit | edit source]

The latest version of this extension can be downloaded from ftp. Download files FramedVideo.php and FramedVideo.i18n.php. Create $IP/extensions/FramedVideo/ directory and copy both files therein.

Installation[edit | edit source]

To install this extension, add the following to LocalSettings.php:

require_once("$IP/extensions/FramedVideo/FramedVideo.php");

Usage[edit | edit source]

Full syntax:

<video type="service" id="1234abc" width="270" height="203" desc="Here's lovelly video" frame="true" position="right" size="full" allowfullscreen="true"/>

Usual syntax:

<video type="service" id="1234abc" desc="Here's lovely video"/>

Note: blip.tv requires width2 parameter for proper scaling.

Parameter Required Means Allowed values Recommended
values
Default
value
type yes, if video isn't from YouTube service id bbsports, bliptv, break, broadcaster, comedycentral, clipfish, clipshack, dailymotion, eyespot, funnyordie, gazeta, glumbert, googlevideo, interia, jumpcut, kewego, liveleak, livevideo, metacafe, myspacetv, myvideo, patrz, photobucket, plejada, putfile, revver, rutube, selfcasttv, sevenload, sharkle, shoutfile, spike, stickam, superdeluxe, uncutvideo, veoh, viddler, videojug, vimeo, wrzuta, yahoovideo, youaretv, youtube, youtube2 - youtube
id yes video id from service
(check codes)
deppends on video service - -
width no video width 1–852 270 270
width2 only when video came from blip.tv video width 1–852 - -
height no (yes when video came from Dailymotion or Vimeo) video height 1–510 - depends on width
desc no description below video - empty -
frame no sets frame true, false true true
position no video position left, right, center left, right right
size no use default size (not allowed for Dailymotion and Vimeo) full empty empty
allowfullscreen no setting for allowfullscreen parameter true, false true true

Configuration[edit | edit source]

MW messages[edit | edit source]

When installing, the default English messages are used (but see supported languages for more). If you translated this messages into your language, please put them in talk page and claim that you relased it under GPL terms.

Some configuration can be done via MediaWiki messages or through light mode and LocalSettings.php. Here's the full list of messages that extensions creates (they do not exist here and will apear when you done installation):

MW message Allowed values What this do
Framedvideo_default_width integer
(default: 270)
Default video width for the whole wiki, used when width parameter is empty (but check next message).
Framedvideo_force_default_size boolean
(default: false)
Do we force the default width or do we allow users to set their own?
Framedvideo_max_width integer
(default: 852)
Max allowed width based on the highest width used by one of supported services. Probably setting more than around 1000 will break skins, when user decides to set it. Setting more than 2000 is just crazy.
Framedvideo_max_height integer
(default: 510)
Max allowed height based on the highest height used by one of supported services.
Framedvideo_allow_full_screen boolean
(default: true)
Global setting for allowfullscreen parameter used in embed code (it's not aplying everywhere).
Framedvideo_force_allow_full_screen boolean
(default: false)
Do we force the default setting for allowfullscreen or do we allow users to set it on their own?
Framedvideo_frames boolean
(default: true)
Global setting for frames.
Framedvideo_force_frames boolean
(default: false)
Do we force the default setting for frames or do we allow users to set it on their own?
Framedvideo_position string
(default: right)
Global setting for video position.
Framedvideo_force_position boolean
(default: false)
Do we force the default setting for video position or do we allow users to set it on their own?
Framedvideo_error string Message to show when one error appear.
Framedvideo_errors string Message to show when more errors appers.
Framedvideo_error_unknown_type string Message to show when given type parameter value is unknown.
Framedvideo_error_no_id_given string Message to show when no id parameter is given.
Framedvideo_error_height_required string Message to show in case of services having few heights in embed codes.
Framedvideo_error_height_required_not_only_width string Message to show in case of services having few heights in embed codes, but user gaves only width parameter.
Framedvideo_error_width_too_big string Message to show when given width value is higher than Framedvideo_max_width or $wgFramedVideoMaxWidth allows.
Framedvideo_error_height_too_big string Message to show when given height value is higher than Framedvideo_max_height or $wgFramedVideoMaxHeight allows.
Framedvideo_error_no_integer string Message to show when given value of width or height parameter is not a positive number.
Framedvideo_error_limit string Message to show within Framedvideo_error_width_too_big or Framedvideo_error_height_too_big providing the highest allowed value.
Framedvideo_error_full_size_not_allowed string Message to show in case of services having few heights in embed codes, where setting size="full" may cause troubles.
Framedvideo_error_see_help string Message that provides link do help page. Supports wikitext.
Framedvideo_error_height_and_width_required string Message to show when video requires height and width2 or width parameter, but they are not given.
Framedvideo_desc string Description that appears on Special:Version.

Light mode[edit | edit source]

Light mode is a new feature added in version 1.1 that allow setting some global variables through LocalSetting.php instead of MW messages. Light mode, when properly configurated and no user's errors are made, decreases number of database queries to 0.

To use FramedVideo in light mode you should add the following lines after the line

require_once("$IP/extensions/FramedVideo/FramedVideo.php");

in your LocalSetting.php file:

$wgFramedVideoLightMode = true;
$wgFramedVideoDefaultWidth = 270;
$wgFramedVideoForceDefaultSize = false;
$wgFramedVideoMaxWidth = 852;
$wgFramedVideoMaxHeight = 510;
$wgFramedVideoAllowFullScreen = true;
$wgFramedVideoForceAllowFullScreen = false;
$wgFramedVideoFrames = true;
$wgFramedVideoForceFrames = false;
$wgFramedVideoPosition = "right";
$wgFramedVideoForcePosition = false;

Every of this set overrides setting made by MW message. You can still leave some of this values commented out like this:

#$wgFramedVideoDefaultWidth = 270;

so it can be set via MW message. You can also set

$wgFramedVideoLightMode = false;

so there's no need to comment out everything, when there's a need to configure via MW messages. Every of this set is optional. You can leave only

require_once("$IP/extensions/FramedVideo/FramedVideo.php");

and still set everything via MW messages.

When to use light mode
  • If you have big wiki.
  • If you have high traffic wiki.
  • If you have cheap virtual private servers.
  • If you use free hosting.
  • If you don't want your admins to change any of FramedVideo's settings.
When not to use light mode
  • If you have small or private wiki.
  • If you have a strong dedicated server.
  • If you have wiki farm and admins have no access to LocalSettings.php.
  • If you don't have access to LocalSettings.php by yourself too often.
  • If you still want to have FramedVideo's settings ready at hand.

Supported services[edit | edit source]

Service Where to find id - URL or embed code
blip.tv <embed src="http://blip.tv/play/AbzzZgA" (…) </embed>
Break <param name="movie" value="http://embed.break.com/NTA3Mjcy">
Broadbandsports http://broadbandsports.com/node/6576
Broadcaster <embed
src="http://www.broadcaster.com/video/external/player.swf?clip=pilgarlic_968_1805633260.flv"
(…)</embed> (without dot)
Clipfish <embed src='http://www.clipfish.de/videoplayer.swf?as=0&videoid=NDE2fDM0&r=1' (…)</embed>
ClipShack http://clipshack.com/Clip.aspx?key=12A72A96545B2039
Comedy Central <embed FlashVars='videoId=170162' (…) </embed>
Dailymotion http://www.dailymotion.com/video/x4ut2d_monitor-heads-homocatodicus_creation
eyespot http://eyespot.com/share?cmd=permalink&r=0XCzIG2UEydNkriEJW0mIWsjqi
Funny or Die http://www.funnyordie.com/videos/eae26bb96d
Gazeta.pl Wideo http://serwisy.gazeta.pl/film/10,28313,5248819,(…)
glumbert http://www.glumbert.com/media/ironing
GodTube http://www.godtube.com/view_video.php?viewkey=2275da59ba352aa5070c
GoogleVideo http://video.google.com/videoplay?docid=-3115198179124180259 (with or without dash)
Interia (Znajomi) <script (…) src="http://video.interia.pl/player.js#97225,425,350"></script>
Jumpcut http://jumpcut.com/view?id=3412CB4A16EA11DDBFF8000423CF037A
Kewego http://www.kewego.com/video/iLyROoaft-IT.html (without dot)
LiveLeak http://www.liveleak.com/view?i=591_1211514053
LiveVideo http://www.livevideo.com/video/FA16D69B002B45EC84C77B905DC3640E/cute.aspx
Metacafe http://www.metacafe.com/watch/1342466/how_to_recycle_a_pillowcase/ (without last backslash)
MySpaceTV http://vids.myspace.com/index.cfm?fuseaction=vids.individual&VideoID=48088438
MyVideo http://www.myvideo.de/watch/366128
Patrz <embed src="http://patrz.pl/patrz.pl.swf?id=340362&r=5&o=" (…)</embed>
Photobucket <embed src="http://i294.photobucket.com/player.swf?
file=http://vid294.photobucket.com/albums/mm97/onlyme2332/psicosis1.flv&sr=1">
Plejada <embed src="http://www.plejada.pl/_d/flash/35962,player_loader.swf" (…) />
Putfile http://media.putfile.com/Redneck-911
Revver http://revver.com/video/909341/best-of-2007-cicada-video/
RuTube http://rutube.ru/tracks/714530.html?v=0202ccd8a4a92c8ea22f091e04927d28
SelfcastTV http://www.selfcasttv.com/Selfcast/playVideo.do?ref=s/86/160 (without first backslash)
sevenload http://en.sevenload.com/videos/FpkksY4-Father-and-Son
Sharkle <embed src=http://www.sharkle.com/externalPlayer/170233/1d1iy42312/3/ (…) </embed>
Shoutfile http://www.shoutfile.com/v/NFVA5xvu/Facebook_Gangsta
Spike http://www.spike.com/video/30-second-hot-chick/2881456
Stickam http://www.stickam.com/editMediaComment.do?method=load&mId=179274577
Super Deluxe http://www.superdeluxe.com/sd/contentDetail.do?
id=D81F2344BF5AC7BBA2E41C8C633726C7E5E821AD3C5FD55F
UnCut Video <param name="FlashVars"
value="aID=1c393649784ee0a32923f12696bbd9f91&site=http://uncutvideo.aol.com/"/>
Veoh http://www.veoh.com/videos/v465909jh3gBDCe?…
Viddler <embed src="http://www.viddler.com/player/ff6a9d9b/" (…)</embed>
VideoJug <embed
src="http://www.videojug.com/film/player?id=6bdae9a1-d8c8-5c06-3b58-ff0008ca6bff" (…)
</embed>
Vimeo http://vimeo.com/950846
Wrzuta <script type="text/javascript" src="http://www.wrzuta.pl/wrzuta_embed.js?wrzuta_key=tbFJ6yJDnt
&wrzuta_flv=http://www.wrzuta.pl/vid/file/tbFJ6yJDnt/austria-polska_1_1>
&wrzuta_mini=http://c2.wrzuta.pl/wm14658/1d040325000c5b484851938e/Austria-Polska%201%3A1
&wrzuta_name=Austria-Polska%201%3A1
&wrzuta_width=450&wrzuta_height=416"></script>
Yahoo! Video <param name="flashVars" value="id=3048587&vid=660306&lang=en-us&intl=us&thumbUrl=&embed=1" />
You Are TV http://www.youare.tv/watch.php?id=2727
YouTube

Onchannel.Net

Chmov.com

http://youtube.com/watch?v=Tds7hzkZsSk
(for 480x295px videos use type="youtube2" instead of type="youtube")

Supported languages[edit | edit source]

This languages are supported when handling user's errors. Extension will work well with any wiki language. You can help with translation.

  • English
  • Polish

Known issues[edit | edit source]

Extension compatibility[edit | edit source]

This extension will not work with EmbeddedVideo extension since they're using the same <video/> tag. If you already have EmbeddedVideo installed on your wiki, you can change the following line in FramedVideo.php:

$wgParser->setHook('video', 'renderFramedVideo');

to:

$wgParser->setHook('video2', 'renderFramedVideo');

and use <video2/> tag for embedding throught FramedVideo. Or you can change it to whatever you want.

Video services issues[edit | edit source]

The following services videos aren't scalable at all (using size="full" is recommended):

  • Break
  • ClipShack
  • Comedy Central (requires widht and height parameters, videos has few sizes)
  • Interia (Znajomi)

The following services players are not fully scalable (tested on default width 270):

  • Gazeta.pl Wideo (progress bar gets extremelly small)
  • Shoutfile (progress bar and volume bar overlaps)
  • Viddler (progress bar looks bugged)

Unwanted services[edit | edit source]

If you don't want some services to be supported on your wiki, go to lines 40-85 in FramedVideo.php and uncomment what you need, for example change:

	$twidth['youtube'] = 425;		$theight['youtube'] = 344;

to:

	#$twidth['youtube'] = 425;		$theight['youtube'] = 344;

so YouTube will not longer be recognized as supported service.

Bugs and contribution[edit | edit source]

  • If you find any bugs, please describe it on talk page.
  • If you know any other video services that can be added to this extention, leave info on talk page.
  • If you can help with translating MW messages into your language, please put them translated (check latest version of FramedVideo.i18n.php for what needs translation) on talk page and claim that you are releasing it under GPL terms.
  • If you had an idea on what more this extensions may do, well, you know where talk page is.

Changelog[edit | edit source]

version date description
v1.1.2 2009-04-07 fixed Vimeo's and Dailymotion's scalling bug
v1.1.1 2009-01-03 fixed fullscreen mode
v1.1 2008-12-17
  • added light mode to decrease database calls
  • other tweaks to decrease database calls: now the typical number of database calls is 0 for light mode and 10 without light mode (user's errors still needs some more calls, but they should be rare); the previous versions could made a houndreds of database calls on pages with lots of video embedded; I hope nobody experienced any wiki slows for this reason
  • Clipfish, MySpaceTV and MyVideo added
  • fixes in internationalisation file
v1.0.5 2008-12-12 added support for YouTube's 480x295px videos (use for them type="youtube2" instead of type="youtube")
v1.0.4.2 2008-10-20 another typo fixed
v1.0.4.1 2008-10-16 typo fixed, GoogleVideo is working back now
v1.0.4 2008-10-06
  • fixed fullscreen modes for GoogleVideo and YouTube thanks to Austin Wheeler
  • fixed language issues
v1.0.3 2008-10-04 LiveVideo and glumbert added
v1.0.2 2008-08-17
v1.0.1 2008-07-24 fixed XSS possibility
v1.0 2008-07-09 first stable release

See also[edit | edit source]