additional sites - Embedding videos and audio from other sites (archive.org, teachertube, slideshare, godtube, audioo)
Embedding Flash: swf.php / Attach:flashvid.swf
By installing the following recipe, any link ending in .swf will automatically be converted to HTML code for an embedded Flash animation.
Place the swf.phpΔ script in your cookbook/ directory, and add the following line to config.php:
include_once('cookbook/swf.php');
The swf.php script uses a reduced Twice Cooked method and causes links ending in ".swf" to be converted to embedded Flash movies (similar to how images are automatically embedded into pages).
In addition, the %width=% and %height=% WikiStyles are extended to apply to the embedded content. It is adviseable to specify the width and the height to get proper size of the swf file. Otherwise you may not see it in correct size.
For Example use: %width=640px height=400px%Attach:MyFlash.swf To center flash object use %center%%width=640px height=400px%Attach:MyFlash.swf
Discussion for swf.php
add your commments/requests/bugs here please, newest comments at the bottom. please date and sign your comment as well.
Note: the swf.php script is using the Flash 6 player (applets generated with Flash MX). For MX2004 and later (or earlier, if you're using some obsolete Flash features), you'd have to alter the $SwfTagFmt string to fit html generated by that version of Flash (or AfterShock). -Radu
When I try using an absolute URL to an swf file, the height and width don't seem to work. It will wrap the object tag with a span of the specified height and width, but it won't put the height and width into the object tag itself. -bdk?
Width and height are optional. Setting $EnableExternalResource = 0; will disable use of syntax 2, i.e. only uploaded flash animations can be shown, not externally linked ones. ~HansB
Discussion for flash.php & flash2.php
add your commments/requests/bugs here please, newest comments at the bottom. please date and sign your comment as well.
very strange: I tried uploading a working version that I had locally stored, and the version on the server remains corrupted; perhaps the file's permissions need to be adjusted?shi March 19, 2008, at 07:38 PM
I have fixed a number of bugs in flash.php and uploaded it as flash2.phpΔ - the old version broke attachments in a subtle way (which appeared after the flash video on a given page) - Ed Wildgoose (contact me via http://www.mailasail.com)
The server's settings may be set to disallow the overwriting of uploaded files. See UploadsAdmin for info.
flash.php External Data Issue
just having a small problem with this. my flash file loads some external movie clips and this is not happening on my wiki pages. the flash file runs fine when embeded in a normal html page. would like to fix this if i knew how.
I'm experiencing some difficulty with flash.php and external data as well. From what I can tell, it's a relative path issue. It seems that relative paths inside flash movies do not resolve correctly within the pmWiki file structure. I'll test for absolute paths later. Is this a known issue? Does pmWiki have problems parsing other relative paths?
just something it took me a day to realize: it appears that when embedding a flash video that is uploaded to a different group within the same Site than the page you're putting it on (say it's uploaded to MainGroup, but you're now trying to embed it onto a page in ThisOtherGroup), one must treat it like an external URL, and provide an absolute link:
for instance, this doesn't work (presuming flashfile is uploaded to a different group on the same site)
Flash videos produced at screencast.com include video and audio controls in the exported swf. No extra files to deal with as are produced for example by Camtasia. Screencast.com Registration is free.
hi simon. see the audioo recipe below - it's a standalone recipe that permits parameters to be passed along to Flash. perhaps it can be used as a template for developing a plugin for the fotki.com player. overtones99 October 20, 2009, at 08:21 PM
Updates for flash.php
2006-07-23: Added missing type declaration. Updated to newer swflash.cab version.
2006-09-19: Fixed some confusion of " and ' to quote strings in the "<object>...</object>" code. Now Firefox even display the flash again.
... where 'videocode' is the unique alpha-numberic id assigned to your movie.
For example, if the URL to play the video is:
http://youtube.com/watch?v=nr-SZXIVvuo
you would type:
(:youtube nr-SZXIVvuo:)
In addition, Replace-On-Edit Patterns ($ROEPatterns) have been created for each recipe, so that wiki-editors can simply copy-and-paste the embed code from the respective video website, click 'save' or 'save-and-edit', and have the code automatically converted to the appropriate PmWiki markup. If this is undesired, an admin can disable this in config.php by setting $YouTubeROEenabled, $VimeoROEenabled, etc to false.
Installation
To enable this recipe, put swf-sites.phpΔ in your cookbook directory, and add the following line to config.php:
include_once("$FarmD/cookbook/swf-sites.php");
Be sure to add any default setup variables before including the recipe. See below for details.
Video Parameters
The following websites allow embedding on external sites. Please read up on which parameters are available for each videoplayer, as they're all pretty different in the functionality they permit.
YOUTUBE
The YouTube markup can accept various parameters as defined by the YouTube api, via the following format:
An abbreviated* list of common YouTube parameters available in this recipe (some are part of the YouTube api, and some are simply convenience parameters):
width & height (defaults: width=425, height=344) - in pixels, but don't add 'px' at the end! (non-api)
scale (default: 1) - scale the video's dimensions by some numerical factor (ex: 0.5 = half-size) (non-api)
playlist - 0 or 1 (default: 0) - provide this if you're embedding a playlist (non-api)
loop - 0 or 1 (default: 0)
start - 0 or 1 (default: 0) - starting frame of the video
autoplay - 0 or 1 (default: 0)
fs - 0 or 1 (default: 0) - add the fullscreen button to the playbar
border, color1 & color2 - (default: border=0) - border adds a frame around the video, of the color1; color2 affects the controls (whether or not border is turned on). colors are supplied in hexadecimal, but with no '#': color1=996633
nocookie - 0 or 1 (default: 1) - if enabled, video will come from http://www.youtube-nocookie.com(approve links), for privacy issues
* For more possible parameters, see the YouTube api reference page:
... or if you'd like it to loop, with FullScreen enabled, and you'd like to double the default size
(:youtube nr-SZXIVvuo loop=1 fs=1 scale=2:)
... or provide your own width & height
(:youtube nr-SZXIVvuo width=425 height=344:)
The following default setup variables are available for use in config.php, before including the recipe:
$YouTubeDefaultParams - an array defining the defaults for the parameters listed above. Set parameters like so: $YouTubeDefaultParams['scale'] = '1.3';
$YouTube_XHTMLcompliant - true or false (default: true) - set to false if you'd rather use the non-XHTML-compliant embed code from the YouTube site
$YouTubeROEenabled - true or false (default: true) - turns Replace-On-Edit-Patterns Off/On for embed code pasted into a browser window
$YouTubeROEFmt - default is '(:youtube $1 scale=1:)' - default replacement of YouTube embed code - change it if you'd rather YouTube embed code be replaced with a different set of default variables.
VIMEO
Vimeo markup accepts various parameters via the following format:
width & height (defaults: width=400, height=327) - in pixels, but don't add 'px' at the end! (non-api)
scale (default: 1) - scale the video's dimensions by some numerical factor (ex: 0.5 = half-size) (non-api)
show_title - 0 or 1 (default: 1) - displays the title of the video
show_byline - 0 or 1 (default: 1) - displays the name of the artist/author/creator
show_portrait - 0 or 1 (default: 0) - displays the portrait of the creator
color - a hex color-code, with no leading '#' (default: 00ADEF) - the color of the videoplayer text and controls
fullscreen - 0 or 1 (default: 1) - permits the fullscreen button on the playbar
autoplay - 0 or 1 (default: 0)
loop - 0 or 1 (default: 0)
Examples:
Simplest vimeo embed:
(:vimeo 6507668:)
... or provide your own width & height
(:vimeo 6507668 width=425 height=344:)
The following default setup variables are available for use in config.php, before including the recipe:
$VimeoDefaultParams
$Vimeo_XHTMLcompliant - true or false (default: true) - set to false if you'd rather use the non-XHTML-compliant embed code from the Vimeo site.
$VimeoROEenabled - true or false (default: true) - turns Replace-On-Edit-Patterns Off/On for embed code pasted into a browser window
$VimeoROEFmt - default is '(:vimeo $1 scale=1 $2 $3 $4 $5:)' - default replacement of Vimeo embed code - change it if you'd rather Vimeo embed code be replaced with a different set of default variables.
GOOGLEVIDEO
GoogleVideo markup accepts a handful of optional parameters, though not as many as Vimeo & Youtube:
The following default setup variables are available for use in config.php, before including the recipe:
$GoogleVideoDefaultParams
$GoogleVideo_XHTMLcompliant - true or false (default: true) - set to false if you'd rather use the non-XHTML-compliant embed code provided at the GoogleVideos site
$GoogleVideoROEenabled - true or false (default: true) - turns Replace-On-Edit-Patterns Off/On for embed code pasted into a browser window
$GoogleVideoROEFmt - default is '(:googlevideo $1 scale=1:)' - default replacement of Vimeo embed code - change it if you'd rather Vimeo embed code be replaced with a different set of default variables.
FLICKRVID
FlickrVid markup accepts a handful of parameters, though not as many as Vimeo & Youtube:
* Note - flickrvid has changed since previous version. Previously it declared the videocode via id=videocode; now the videocode is unprefixed, and must appear immediately following (:flickrvid ....
To locate the correct videocode, look in the embed code for "photo_id=somenumber"
FlickrVid parameters:
secret (required) - this can be obtained from the embed code on the users pages - look for photo_secret=somenumber
id (required) - the id for the video - look in the embed code for photo_id=somenumber
width & height (defaults: width=400, height=300) - in pixels, but don't add 'px' at the end! (non-api)
scale (default: 1) - scale the video's dimensions by some numerical factor (ex: 0.5 = half-size) (non-api)
showinfo - 0 or 1 (default: 1) - display the video information before and after playing
Examples:
Simplest FlickrVid embed:
(:flickrvid 98765 secret=43210:)
... or provide your own width & height, and turn video info off
The following default setup variables are available for use in config.php, before including the recipe:
$FlickrVidDefaultParams
$FlickrVidROEenabled - true or false (default: true) - turns Replace-On-Edit-Patterns Off/On for embed code pasted into a browser window
$FlickrVidROEFmt - default is '(:flickrvid [args] scale=1:)' - default replacement of FlickrVid embed code - change it if you'd rather FlickrVid embed code be replaced with a different set of default variables.
* Note: FlickrVid is not yet XHTML 1.0 compliant - I was unable to locate any leads online yet that seemed to work. If you have any suggestions, please do let me know.
2009-10-25 - slightly cleaned up & simplified youtube code (scaling); removed plwidth & plheight from docs, to prevent misuse.
2009-10-20 -
Vimeo, GoogleVideo, FlickrVid: updated (:vimeo:) & (:googlevideo:) & (:flickrvid:) to allow arguments, and created a number of various setup variables accessed in config.php
Vimeo, Youtube, GoogleVideo, FlickrVid: added ROEPatterns to auotmatically convert pasted <embed> code with the appropriate pmwiki video markup
cleaned up YouTube code
fixed GoogleVideo bug that prevented fullscreen
permitted option of compliant and non-compliant XHTML versions of each recipe (except FlickrVid).
removed $YouTubeDefaultHeightFmt & ..WidthFmt (for all recipes) - default width and height are now included in $YouTubeDefaultParams, $VimeoDefaultParams, and so forth.
changed FlickrVid so that videcode is declared like YouTube, GoogleVideo, and Vimeo - with it as the first argument, and without the id= prefix
replaced/updated much of the documentation
2009-10-09 - YouTube: added 'scale' option for youtube; returned youtube code back to being xhtml 1.0 compliant; incorporated suggestion from Byron Lunz for non-XHTML-compliant version, via $YouTube_XHTMLcompliant
2009-09-21b: YouTube: added ability to embed YouTube playlists
2009-09-21: Updated swf-sites.php - changed YouTube code so that it accepts valid YouTube api parameters
previously:
2008-04-09: Edited swf-sites.php to include Flickr video. (JRH)
2008-01-22: Edited swf-sites.php to swf-sites2.php to update YouTube & Google functions. (BKL)
2007-08-29: Added Vimeo and combined with YouTube and Google Video into swf-sites.phpΔ
2007-02-07: Updated YouTube and GoogleVideo recipes. They both now feature valid XHTML.
Discussion for swf-sites.php
add your commments/requests/bugs here please, newest comments at the bottom. please date and sign your comment as well.
Hi. Im using the swf-sites recipe. (:youtube tgbNymZ7vqY:) works fine. (:youtube tgbNymZ7vqY width=425 height=344:) - which is listed as possible code above - doesn't work at all. No video is shown. Also "scale" as "default variable" doesn't have any effect on the video's dimension. And YES I added it before the "include"-line. What am I doing wrong? me - Feb 15 2010
hi. sorry you're having trouble with the recipe. the examples you've provided above work fine on my site - http://plus1plus1plus.org/Resources/PmWiki-swfsites-test - i'm running pmwiki 2.2.6, and 2009-10-25 version of the swf-sites recipe. i'll try updating my pmwiki to the latest version in the next day or two to see if any problem arises, though i don't think that will change anything. in the meantime, can you tell me what you included in your config? what exactly did you add above the "include"-line? my setup looks like this and works fine:
Other recipes like svg, flashmediaplayer works quite fine. 'm running 2.2.11. At the moment only your to lines are added for including swf-sites.php. me - Feb 16 2010
hi. it looks like it might be a php-version issue. i followed the link you left on my page and i get the error message: "Fatal error: Call to undefined function: array_diff_key() in /homepages/45/d67474843/htdocs/test/cookbook/swf-sites.php on line 443" - which tells me that your server is probably running a version of php less than 5.1.0 (see http://us.php.net/manual/en/function.array-diff-key.php). can you confirm this by checking your phpinfo page? if indeed this is the case, then i'll try as soon as possible (sometime soon, but unfortunately probably not today or this week) to figure out a workaround. also - was this error msg showing up all along, or is it new for this go-round? you didn't mention any error msg in your first post - it just sounded like the video just wasn't showing up on the page. is the error new? overtones99 February 16, 2010, at 08:46 AM
Hi. First I saw, that you're running another recipe-version then me. No idea where I downloaded an older one. After uploading the actual one - i got the error-message. So I checked the php-version. It was 4.4.9. In contrast my provider claims he offers php5... [sic] I checked the help-pages and read that I have to activate php 5 on my own - by default php4 is used... now it works - so you don't need to make a workaround.
Sorry for the first "error" (shame on me) - the second error I could fix on my own. me - Feb 16 2010
glad to hear it works now! overtones99 February 17, 2010, at 04:03 AM
Flash videos from other sites
Flash from other (less common?) sites can be installed via separate cookbook recipes. If you have a recipe for sharing videos from another site, feel free to use the following recipes as template and add it below.
An $ROEPatterns has been included so that users can simply copy&paste the provided archive.org embed-code, and it will automatically convert into valid pmwiki markup.
to create a playlist of multiple tracks of audio or video, several videocodes can be listed with commas in between, wrapped with one set of [square brackets]:
Note 1: at this point this does not appear with the tray of tracks like it does on the archive.org site - this is a limitation of the flowplayer setup on archive.org, not of the recipe. However, one can navigate the playlist using the >> and << buttons, and the ROEPattern will spit out a list of the available tracks beneath the player
Note 2: that there is currently a bug for video playlists; when copying & pasting directly from archive.org, the videos often have the first slot of the playlist filled with an 'image.jpg', which currently causes the video to automatically begin playing. i hope to fix this soon, but for now one can prevent this autoplaying by simply removing the jpg from the playlist.
Currently available parameters:
Archive.org currently uses the FlowPlayer (v. 3.0.5 - not the most up-to-date version) to view most of its media, which is a surprisingly versatile open source media player. Many, though not all, of the FlowPlayer parameters have been enabled in this recipe; note that for most of these, empty values in $ArchiveOrgPlayerDefaultParams ('') will in most cases (but not all) implement the FlowPlayer defaults.
hideDelay (default: 500) - how long it takes to hide the controls (in milliseconds) [note: the flowplayer autoHide is not perfect and sometimes disappears altogether if the hideDelay is too low]
bottom (default: 0) - bottom position of the controlbar, measured in pixels
top (default is empty) - top position of the controlbar, measured in pixels from the top
ctrlHeight - height of controlbar
ctrlWidth - width of controlbar
opacity (default: 0.95) - opacity of controls (a decimal value between 0-1)
borderRadius (default: 0) - rounding of the controller's edges (default/0 is no rounding)
backgroundColor (default: #000000) - a #hex value
backgroundGradient (default: medium)
timeColor (default: #eeeeee) - a #hex value
durationColor (default: #01DAFF) - a #hex value
progressColor (default: #777777) - a #hex value
progressGradient (default: none) - vals: none, low, medium or high; or an array: [0.2, 1.0]
bufferColor - a #hex value
bufferGradient - none, low, medium or high; or an array: [0.2, 1.0]
sliderColor (default: #777777) - a #hex value
sliderGradient - none, low, medium or high; or an array: [0.2, 1.0]
buttonColor (default: #333333) - a #hex value
buttonOverColor (default: #505050)
volumeSliderColor - a #hex value
volumeSliderGradient - none, low, medium or high; or an array: [0.2, 1.0]
timeBgColor - a #hex value
Other Options For config.php
$linkToArchiveOrg - possible values: true, false, "ROE" (default: "ROE") - links in the FlowPlayer context menu currently fail for archive.org, making it very hard for a visitor to be able to locate and download these freely available files.
By setting $linkToArchiveOrg = true; in config.php, the archive.org player will always display a small html link to the page where the files are stored (http://www.archive.org/details/PageName(approve links)) directly beneath the player. This will affect all players on the website.
Another option, $linkToArchiveOrg = "ROE"; adds a similar link via pmwiki markup during the ROE (Replace-On-Edit) process (i.e. %newwin%[[http://www.archive.org/details/PageName | download from Archive.org]]); this allows each user to choose whether or not to include such a link.
And finally, if this is too much clutter for you, set $linkToArchiveOrg = false; and no link will appear for any player.
$hexcheck_enabled (default: false) - normally a user is required to supply color-hex-codes in the form '#AABBCC', and if they don't supply the leading '#' the color will fail. to avoid this scenario, set $hexcheck_enabled = true;, and the recipe will check for '#' and then add it to color codes where necessary.
$trackListing_enabled (default: true) - many videos and audio available from archive.org are playlists containing multiple tracks; the problem is that when embedded on an external site, the current version of the archive.org player doesn't display the dropdown menu of all the tracks - it only has << and >> search buttons. This is misleading and may cause a visitor to think there is only 1 track available. Setting $trackListing_enabled = true; causes a list of all tracks to be posted beneath the player during the ROE process, along with a note about how to use the << & >> buttons.
$ArchiveOrgROEParamsVideo (default: array('width', 'height', 'autoplay', 'fs', 'scale')) & $ArchiveOrgROEParamsAudio (default: array('width', 'height', 'autoplay')) - these variables determine which parameters will show up during the ROE process when a user pastes archive.org embed code into the edit window and saves. Users may not always be aware of all the various parameters available to them, so the usefulness of expanding these arrays is to help make users aware of their options, and to encourage them to customize their players; for instance, adding 'durationColor', 'progressColor', etc to the array would result in ROE's resulting in (:archive.org filename ... durationColor=... progressColor=... :).
Versions:
2010-01-02 - links in the context menu for the player don't currently work, so added $linkToArchiveOrgovertones99
For TeacherTube, use teachertube.phpΔ and add the following to config.php
include_once("$FarmD/cookbook/teachertube.php");
Put in the unique ID for the movie, not the whole URL, something like (:teachertube 7f89ddbebc2ac9128303:)
SlideShare
For SlideShare, use slideshare.phpΔ and add the following to config.php
include_once("$FarmD/cookbook/slideshare.php");
Put in the unique ID for the movie, not the whole URL, something like (:slideshare jbrenman/shift-happens-33834:)
Put the doc value for the movie, it found in embed code for Wordpress. Something like
(:slideshare what-is-web-20-1194363300579044-4:)
GodTube
For godTube, use godtube.phpΔ and add the following to config.php
include_once("$FarmD/cookbook/godtube.php");
Put in the unique ID for the movie, not the whole URL, something like (:godtube flvideo1/20/17395:) or (:godtube flvideo/4ee3524ccf035d35b284/1650:)
Working example (doesn't seem to have a working example any more...
Audioo
Audioo (http://audioo.com) allows visitors to embed audio content from their site the same way one would embed video from YouTube. To embed their flashplayer, put audioo.phpΔ in your cookbook, and add the following line to config.php:
include_once("$FarmD/cookbook/audioo.php");
An $ROEPatterns has been included so that users can simply paste in the audioo.com embed code, and it will automatically convert into valid pmwiki markup.
The videocode for this recipe is the entire URL for the audioo page.
add your commments/requests/bugs here please, newest comments at the bottom. please date and sign your comment as well.
Is there an update now that GodTube has become Tangle? Thanks - Think1
I would really appreciate it if someone could write up a cookbook for embedding mp3 audio files: see http://www.macloo.com/examples/audio_player/. Added January 2009. or even for embedding mp4 video files. Thanks again. LFS
Sandbox
This first two flash recipes have been enabled on this page.
Ed Wildgoose, fixed a number of bugs in flash.php and uploaded it as flash2.phpΔ - the old version broke attachments in a subtle way (which appeared after the flash video on a given page) - (contact me via http://www.mailasail.com)
User notes: If you use, used or reviewed this recipe, you can add your name. The following format is recognized:
* (+) Optional positive comment. Name, date
* (-) Optional negative comment. Name, date
These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.