Recent Changes - Search:

Cookbook

PmWiki

pmwiki.org

Flash

Summary: Embedding Flash movies; plus recipes for embedding Flash from specific sites like YouTube, Vimeo, GoogleVideo, Flickr, Archive.org, and more...
Version: 2006-10-28 (flash.php & swf.php), 2011-06-16b (swf-sites.php), 2011-02-21 (archive.org.php), 2010-12-21 (swf-sites-Flickr.php)
Prerequisites: pmwiki-2.1.19; swf-sites.php requires PHP 5 >= 5.1.0
Status:
Maintainer:

Question

Can Flash (*.swf) movies be embedded into wiki pages?

Answer

Yes. There are several solutions depending on the situation:

Embedding Flash .swf files (2 options):

  • swf.php recipe - automatically convert any link ending in ".swf" to the correct HTML code for an embedded Flash animation
  • flash.php recipe - an alternative to swf.php that uses a different syntax

Embedding video content from video sharing sites:

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?

Here is an informative blog entry for standards compliant flash.

This one is almost useless, since most .flv videos are too large to attached (exceed 5000kb), and, .flv is not an allowed extension for attachments. tonybaldwin February 21, 2011, at 09:58 AM
hi tony. don't know much about this recipe, but pretty positive it only works for swf. however, you can use the archive.org player below to play flv's that are uploaded to archive.org. overtones99 February 21, 2011, at 04:04 PM

Embedding Flash: flash.php & flash2.php / (:flash ... :)

flash.phpΔ and flash2.phpΔ are two other scripts for flash embedding, using a different syntax.
  • Install the usual way in cookbook and add to config.php
include_once("$FarmD/cookbook/flash2.php");
  • Markup syntax examples:
    1. (:flash Attach:myflashfile.swf width=300 height=200:)
    2. (:flash http://example.com/path/myflash.swf width=200 height=200:)
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 Attach:MainGroup/flashfile.swf width=150 height=100:)
but this DOES work with the absolute address:
(:flash http://blah.com/pmwiki/uploads/MainGroup/flashfile.swf width=150 height=100:)
overtones99 April 21, 2008, at 08:17 PM
Couldn't get this to work. Then again, my video is .flv, not .swf. This only works with .swf? I wonder if I can convert the .flv or .mpg to .swf...probably with ffmpeg? tonybaldwin February 21, 2011, at 10:14 AM
Note, there doesnt seem to be a way of handling parameters to flash. E.g. This is what we need:
<object type="application/x-shockwave-flash" data="http://images.fotki.com/flash/FlipBook-1.0.swf" 
width="139" height="202"> <param name="movie" value="http://images.fotki.com/flash/FlipBook-1.0.swf"> 
<param name="wmode" value="transparent"> <param name="quality" value="best"> <param name="flashvars" 
value="url=http%3A//feeds.fotki.com/simonhobbs/album_tdskbkfrdrfkt.rss&amp;linkcolor=%235471B9&amp;
bgcolor=%23DFE5F4&amp;rows=4&amp;cols=3&amp;el_size=45"> </object>

Any ideas?
SimonH

PL 8 October 2009
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.

YouTube, Vimeo, and GoogleVideo and Flickr Video (Flickr has moved into a separate recipe - see below)

swf-sites.phpΔ enables embedding YouTube, Vimeo, and Google Video videoplayers into wiki pages.

Demo: http://plus1plus1plus.org/Resources/PmWiki-SWFsites

Simple Embed

As of version 2010-12-18, YouTube, Vimeo & GoogleVideo videoplayers can now be embedded by simply pasting the videos URL rather than the full embed code:

http://www.youtube.com/watch?v=nr-SZXIVvuo

Pasting a URL like the one above for any of these 3 online video services will automatically embed the video using the default parameters to determine dimensions, scaling, etc (as declared in the recipe or by the user in config.php in $YouTubeDefaultParams, $VimeoDefaultParams, and $GoogleVideoDefaultParams). For more info on how to set these default parameters, see the advanced embed code explanations in the following sections.

If you'd like to display a video's URL as-is without its being embedded, simply precede it with a `:

`http://www.youtube.com/watch?v=nr-SZXIVvuo

The SimpleEmbed feature is turned ON by default in the swf-sites recipe. If you want to disable this feature but still have access to the videocode presented below, you can do so by declaring the following in your config.php before including the recipe:

$YouTubeSimpleEmbed = false;
$VimeoSimpleEmbed = false;
$GoogleVideoSimpleEmbed = false;

Advanced VideoPlayer Markup via SWF-Sites

To embed these videoplayers in a simplified fashion, and to be able to access their various parameters, they can be embedded via something like this:

(:youtube videocode:)
(:vimeo videocode:)
(:googlevideo videocode:)

... 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 and the terms they use.

YOUTUBE

SimpleEmbed
Remember, YouTube videos can be embedded by simply pasting the URL, i.e.

http://www.youtube.com/watch?v=nr-SZXIVvuo
or
http://youtu.be/nr-SZXIVvuo
or
http://youtu.be/nr-SZXIVvuo?t=1m20s (adding a start time)

The wiki admin can set the default parameters in config.php via $YouTubeDefaultParams. To disable this SimpleEmbed feature, simply declare $YouTubeSimpleEmbed = false; in config.php. See above for more details.


Advanced YouTube Markup
The YouTube markup can accept various parameters as defined by the YouTube api, via the following format:

(:youtube videocode [ param1=val1 param2=val2 ... ] :)
[ brackets denote optional arguments ]

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) - multiplier for both the width and height (ex: scale=0.5 cuts both the width and height in half, resulting in a 1/4-size video; 0.707 = ~1/2-size video; etc) (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, for privacy issues
  • modestbranding - 0 or 1 (default: 0) - if enabled, this will hide the YouTube logo from the control bar

* For more possible parameters, see the YouTube api reference page:

Examples:
if you'd like your video to loop:

(:youtube nr-SZXIVvuo loop=1:)

... 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';
  • $YouTubeOverrideUserParams - admins can provide a list of default parameters that will override any user-input. example: $YouTubeOverrideUserParams = 'fs,width,height'; will prevent users from changing the availability of fullscreen mode, and from changing the width and height of the embedded video
  • $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.
  • $YouTube_enableNewPlayer - YouTube has a new beta version of their player that uses an iframe; this beta player works with HTML5. This recipe has code to embed this new player instead of the old one, but since it's currently in the beta stage and lacks most of the parameters afforded by the previous player, it is not turned on by default. To start embedding using this new beta, iframe player, then set $YouTube_enableNewPlayer=true in your config. Note: embedded playlists will still use the old version of the youtube player since it doesn't yet seem to be available with the new version.

VIMEO

SimpleEmbed
Remember, Vimeo videos can be embedded by simply pasting the URL, i.e.

http://www.vimeo.com/16894768.

The wiki admin can set the default parameters in config.php via $VimeoDefaultParams. To disable this SimpleEmbed feature, simply declare $VimeoSimpleEmbed = false; in config.php. See above for more details.


Advanced Vimeo Markup
Vimeo markup accepts various parameters via the following format:

(:vimeo videocode [ param1=val1 param2=val2 ... ] :)

Vimeo parameters:

  • width & height (defaults: width=400, height=327) - in pixels, but don't add 'px' at the end! (non-api)
  • scale (default: 1) - multiplier for both the width and height (ex: scale=0.5 cuts both the width and height in half, resulting in a 1/4-size video; 0.707 = ~1/2-size video; etc) (non-api)
  • title show_title - 0 or 1 (default: 1) - displays the title of the video
  • byline show_byline - 0 or 1 (default: 1) - displays the name of the artist/author/creator
  • portrait 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 - an array defining the defaults for the parameters listed above. Set parameters like so: $VimeoDefaultParams['scale'] = '1.3';
  • $VimeoOverrideUserParams - admins can provide a list of default parameters that will override any user-input. example: $VimeoOverrideUserParams = 'fullscreen,width,height'; will prevent users from changing the availability of fullscreen mode, and from changing the width and height of the embedded video
  • $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. - this is only applicable for the earlier version of the Vimeo player, not the new universal version.
  • $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

SimpleEmbed
Remember, GoogleVideo videos can be embedded by simply pasting the URL, i.e.

http://video.google.com/videoplay?docid=4412027748204910365#.

The wiki admin can set the default parameters in config.php via $GoogleVideoDefaultParams. To disable this SimpleEmbed feature, simply declare $GoogleVideoSimpleEmbed = false; in config.php. See above for more details.


Advanced GoogleVideo Markup
GoogleVideo markup accepts a handful of optional parameters, though not as many as Vimeo & Youtube:

(:googlevideo videocode [ param1=val1 param2=val2 ... ] :)

GoogleVideo parameters:

  • width & height (defaults: width=400, height=326) - in pixels, but don't add 'px' at the end! (non-api)
  • scale (default: 1) - multiplier for both the width and height (ex: scale=0.5 cuts both the width and height in half, resulting in a 1/4-size video; 0.707 = ~1/2-size video; etc) (non-api)
  • fs - true or false (default: true) - permits the fullscreen button on the playbar
  • autoPlay – true or false (default)
  • initialTime – start-time in seconds (default is 0)
  • loop – true or false (default)
  • showShareButtons – true or false (default) (not sure if this works)
  • playerMode:
    • embedded (default) (the basic google video skin)
    • simple (no progress bar or volume control)
    • mini (no controls)
    • clickToPlay (used for video ads)

Examples:
Simplest GoogleVideo embed:

(:googlevideo 8953172273825999151:)

... or provide your own width & height, and disallow fullscreen:

(:googlevideo 8953172273825999151 width=425 height=344 fs=0:)

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.

Question - Is there any way to set the start time of a google video? I think you are supposed to be able to do that but I could not get it to work. Perhaps it has to be done on the flash instead of the google video? Example, suppose I want the video to start and 35 seconds from the start, how would I do that? 11/4/10

Answer - Hi - currently, with this recipe, there is not a way to do this – but there will be soon – I just found some pages online that explain how to do this and I will update the recipe accordingly hopefully as soon as I can get to it. Stay tuned. overtones99 November 04, 2010, at 02:29 PM

Hi again - i cleaned up the code and with the new recipe you can now for sure use 'initialTime=XXX' in the GoogleVideo markup to set a start time for a video. the time is measured in seconds... overtones99 November 05, 2010, at 04:46 AM
Ha! THIS ONE works! I have it working here. THANKS! tonybaldwin February 21, 2011, at 10:14 AM

Updates for swf-sites.php

overtones99:

  • 2011-06-16b - YOUTUBE:
    • new features:
      • simpleROE now accepts shortlinks of the form http://youtu.be/abc123;
      • it also accepts start time & hd params http://youtu.be/abc123?hd=1&t=2m20s;
    • BUGFIXES:
      • corrected issue with nocookie=0 not being able to override default setting (thanks FrankHuber!)
      • in old embed code, playlists don't work with nocookie=1 - now nocookie is automatically disabled when embedding a playlist (thanks FrankHuber)
      • old embed code now works with new form of short-link playlists that appends 'PL' to the beginning of the videoID: http://youtube.com/playlist?p=PLxxxxx
      • if new iframe player is enabled, it will now revert to the old player when embedding a playlist (playlists don't yet use the new iframe markup)
  • 2011-06-16 - YOUTUBE - bugfix: iframe ROE for youtube was occasionally mistakenly keeping the "?param=n" when trying to obtain the videoID, i.e. id123abc?param=N
  • 2011-04-07 - YOUTUBE & VIMEO - bugfix: iframe ROE for both was accidentally throwing away height & width values; YOUTUBE: adjusted iframe output that has changed since the last version.
  • 2010-12-19 - YOUTUBE - bugfix to prevent display of extra url arguments &blah=blah....
  • 2010-12-18 - YOUTUBE, VIMEO & GOOGLEVIDEO: added YouTubeSimpleEmbed, VimeoSimpleEmbed, & GoogleVideoSimpleEmbed (respectively) - YouTube, Vimeo & GoogleVideo vids can now be embedded by simply pasting the page URL (rather than the full embed code). to disable, set $YouTubeSimpleEmbed=false (or $VimeoSimpleEmbed=false, or $GoogleVideoSimpleEmbed=false) in config.php
  • 2010-11-14 - YOUTUBE: fixed 2 minor bugs in YouTube code
  • 2010-11-05 -
    • GOOGLEVIDEO: cleaned up code and ensured ability to use params: initialTime, showShareButtons, and playerMode
  • 2010-09-10 - fixed a bug in the $ROEPatterns for the Vimeo Universal embed code
  • 2010-09-01 -
    • VIMEO:
      • added an ROEPattern for the new univeral version of the Vimeo embed code; the ROE for the old version of Vimeo embed code remains enabled as well, since both can be used by embedders. To keep using the old version of the player, one can set $Vimeo_enableNewPlayer=false;. More info on the new Vimeo player, which can run on the iPhone, iPads, and in HTML5: http://vimeo.com/blog:334
      • added an ROEPattern to update old Vimeo markup on pages - parameters like 'show_title' have now been shortened simply to 'title'
      • removed the $Vimeo_ROEFmt variable - now the ROEPattern displays all possible variables as set up in your $VimeoDefaultParams array
      • added $VimeoOverrideUserParams - admins can provide a list of default parameters that will override any user-input.
    • YOUTUBE:
      • added code for playing YouTube video with the new beta iframe version of the player, which works with HTML5. Since it's in beta version, and doesn't have nearly as many features and inputs as the older version, it is off by default. To use this new version, place $YouTube_enableNewPlayer=true; in your config.php.
      • updated YouTube ROEPattern code... Created new ROEPattern for new (beta) YouTube iframe code
      • removed $YouTubeROEFmt - the ROEPattern now displays whatever properties it finds in the embed code.
      • added $YouTubeOverrideUserParams - admins can provide a list of default parameters that will override any user-input.
  • 2010-05-17 - moved FlickrVid into a separate recipe with FlickSlideshow (new).
  • 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:

$YouTubeDefaultParams['rel'] = '0';
include_once("$FarmD/cookbook/swf-sites.php");

overtones99 February 16, 2010, at 02:56 AM

Hi. My config.php

$YouTubeDefaultParams['scale'] = '1.3';
$YouTubeROEenabled = 'false';
include_once("$FarmD/cookbook/swf-sites.php");

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.

FLICKR & FLICKRVID

Demo: http://plus1plus1plus.org/Resources/PmWiki-Flickr

This recipe enables embedding of video and images hosted on Flickr.com using:

(:flickr ...:) for slideshows
&
(:flickrvid ...:) for videos

To install, add swf-sites-Flickr.phpΔ to your cookbook, and add the following line to your config.php:

	include_once("$FarmD/cookbook/swf-sites-Flickr.php");

Be sure to add any default setup variables before including the recipe. See below for details.

ROE is Enabled!

Replace-On-Edit Patterns ($ROEPatterns) have been enabled for this recipe! Visitors can simply copy-and-paste the embed code from Flickr, click save (or save-and-edit), and the embed code will be automatically converted into the appropriate pmwiki markup. If this is undesired, an admin can disable this in config.php by setting $FlickrSlideshowROEenabled & $FlickrVidROEenabled to false.

Examples

FlickrSlideshow and FlickrVid examples can be found at http://plus1plus1plus.org/Resources/PmWiki-Flickr

Other Flickr Slideshow Players

Note that there are many many other homebrew Flickr slideshow players out there. This recipe, however, only enables embedding slideshows that Flickr makes available by clicking the "Share" button during one of their slideshows.

 

FLICKRSLIDESHOW

FlickrSlideshow markup accepts a handful of parameters:

	(:flickr username userID [ photoset ] [ param1=... param2=... ]:)
(in some cases username & userID are optional)

FlickrSlideshow parameters:

  • username
  • userID - numerical ID, usually comes in the format of "12345678@N03" (userID can be found in the embed code for a slideshow, or by visiting http://idgettr.com)
  • photoset - optional: ID for the photoset you want to view (using the number in the url following /sets/12345.../)
  • tag - optional: used if you want display images labeled with a specific tag, i.e tag=cats
  • search - optional: used if you want to display images that comes up during a search, i.e. search=ugly+cats
  • sort (default: relevance) - optional: used in conjunction with search - options include relevance, interest, and recent
  • width & height (defaults: width=400, height=300) - in pixels, but don't add 'px' at the end!
  • scale (default: 1) - scale the slideshow's dimensions by some numerical factor (ex: 0.5 = half-width & half-height) (non-api)
Examples:
Simplest FlickrSlideshow embed:
	(:flickr myusername 12345678@N03:)
Provide your own width & height
	(:flickr myusername 12345678@N03 width=700 height=525:)
Display a photoset (providing a userID not required for this)
	(:flickr myusername 9876543210:)
Display photos in your account that are tagged "cats"
	(:flickr myusername 12345678@N03 tag=cats:)
Display photos in your account that come up when searching for "cats", sorted by most recent
	(:flickr myusername 12345678@N03 search=cats sort=recent:)
Similarly, if you'd like to display any photos on Flickr that are tagged "cats", or that come up during a search of "cats", just omit the account information:
	(:flickr tag=cats:)
	(:flickr search=cats sort=recent:)

If you've added a default username and userID to your config (see below), then these can be omitted from most of the examples above, for example (:flickr:) will return all photos from your photostream.

  • exception: if you want to display tags or searches in your own profile, you *must* provide your username & userID - reason: if the default userinfo was always used, then the recipe wouldn't allow displaying all photos from the rest of flickr with those tags or searchterms.

The following default setup variables are available for use in config.php, before including the recipe:

  • $FlickrSlideshowDefaultParams, examples:
    • set the default width & height
    $FlickrSlideshowDefaultParams['width'] = "700";
    $FlickrSlideshowDefaultParams['height'] = "525";
    • adding these prevents you from ever having to enter in your username or user_id (except in the cases of tag= and search=)
    $FlickrSlideshowDefaultParams['flickr_username'] = "myusername";
    $FlickrSlideshowDefaultParams['flickr_user_id'] = "12345678@N03";
  • $FlickrSlideshowROEenabled - true or false (default: true) - turns Replace-On-Edit-Patterns Off/On for embed code entered into a browser window
  • $FlickrSlideshowROEFmt - default is '(:flickr [args] scale=1:)' - default replacement of FlickrSlideshow embed code - change it if you'd rather FlickrSlideshow embed code be replaced with a different set of default parameters.

Note: FlickrSlideshow is not yet XHTML 1.0 compliant

 

FLICKRVID

FlickrVid markup accepts a handful of parameters, though not as many as Vimeo & Youtube:

(:flickrvid videocode secret=secretval [ param1=val1 param2=val2 ... ] :)

* 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) - multiplier for both the width and height (ex: scale=0.5 cuts both the width and height in half, resulting in a 1/4-size video; 0.707 = ~1/2-size video; etc) (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

(:flickrvid 98765 secret=43210 width=425 height=344 showinfo=false:)

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.

. . .

Versions:
  • 2010-12-21 - fixed bug with FlickrVid that was causing (:flickr:) markup to also catch content intended for (:flickrvid:)
  • 2010-05-16 - initial release - incorporated FlickrVid and FlickrSlideshow into one recipe (FlickrVid originally included in swf-sites.php)

ARCHIVE.ORG

Demo: http://plus1plus1plus.org/Resources/PmWiki-ArchiveOrg

For video or audio from Archive.org, download archive.org.phpΔ and add the following line to config.php:

include_once("$FarmD/cookbook/archive.org.php");
for those updating from any pre-2010-08-29 version, please see the version notes below regarding setting defaults in your config.php via $ArchiveOrgPlayerDefaultParams

SimpleEmbed
Archive.org videos can now (as of version 2010-12-19) be embedded by simply pasting the URL of the video or audio file you want to display, i.e.

http://www.archive.org/download/Lmaster-CatsCatsCats407/Lmaster-CatsCatsCats407_512kb.mp4.

(Unfortunately, since each Archive.org page has multiple versions of a video or audio file, you must use the link to the actual media file, not just the archive.org details page.)

This can be prevented by preceding the URL with a `, i.e.:

`http://www.archive.org/download/Lmaster-CatsCatsCats407/Lmaster-CatsCatsCats407_512kb.mp4.

The wiki admin can set the default parameters in config.php via $ArchiveOrgDefaultParams. To disable this SimpleEmbed feature, simply declare $ArchiveOrgSimpleEmbed = false; in config.php.


Advanced Archive.org Markup
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.

The markup for this recipe looks like:

(:archive.org basename/filename ... :)
or
(:archive.org filename basename=basename ... :)
where basename comes from the archive.org url: (http://www.archive.org/details/basename)
(all parameters are optional)

Parameters may differ for audio and video, but they're mostly the same.
Here's what one track of audio might look like:

(:archive.org gd1975-06-17.aud.unknown.87560.flac16/gd75-06-17s1t01_vbr.mp3 height=24 width=350 
autoplay=false:)

And here's what one track of video might look like:

(:archive.org bb_minnie_the_moocher/bb_minnie_the_moocher_512kb.mp4 height=504 width=640 
scale=1 fs=true autoplay=false autoBuffering=true:)

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]:

(:archive.org [gd1975-06-17.aud.unknown.87560.flac16/gd75-06-17s1t01_vbr.mp3,
gd1975-06-17.aud.unknown.87560.flac16/gd75-06-17s1t02_vbr.mp3,...]  ... :)

... or alternatively using the basename= parameter:

(:archive.org [gd75-06-17s1t01_vbr.mp3,
gd75-06-17s1t02_vbr.mp3,...] basename=gd1975-06-17.aud.unknown.87560.flac16 ... :)
  • Note 1: at this point playlists don't appear with a tray of tracks beneath it like it does on the archive.org site - this is a limitation of the flowplayer setup on archive.org, not of this 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 (if $trackListing_enabled is set to true)
  • 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. Seems to be working now...

Currently available parameters:

Archive.org currently uses FlowPlayer (v.3.2.1 - not the most up-to-date version, but almost) to view most of its media, which is a surprisingly versatile open source media player. Most of the FlowPlayer parameters and properties are available for use in this recipe, and are listed in $ArchiveOrgPlayerDefaultParams (see the recipe - I've done my best to list as many of them as possible, but it's possible I've missed some - feel free to add more via your config.php). For most of these properties, empty values in $ArchiveOrgPlayerDefaultParams ('') will simply implement the built-in FlowPlayer defaults, so it's not necessary to fill them all up. For ease of use, properties exist in several categories which must be cited in order to set them: basicPropertiesVideo, basicPropertiesAudio, clipProperties, controlbarProperties, autohideProperties, canvasProperties. Set sitewide default parameters in your config by declaring something like:

$ArchiveOrgPlayerDefaultParams['clipProperties']['autoBuffering'] = 'true';
$ArchiveOrgPlayerDefaultParams['basicPropertiesVideo']['scale'] = '1.2';
$ArchiveOrgPlayerDefaultParams['basicPropertiesAudio']['width'] = '500';
Basic Non-FlowPlayer Basic Properties
  • width & height (default: 350 x 26 for audio, 640 x 506 for video)
  • scale (default: 1) - a multiplier for width and height (disabled for audio) (ex: scale=0.5 cuts both the width and heighth in half, resulting in a 1/4 size video; 0.707 = ~half-size video; etc) (non-api!!)
  • fs (default: true) - show/hide fullscreen button (disabled for audio)
  • basename - http://www.archive.org/details/basename
Some Common FlowPlayer Clip Properties
FlowPlayer Controlbar Properties

for a complete list of controlbar properites (i.e. ways to style the way the controls for the player look), please visit http://flowplayer.org/plugins/flash/controlbar.html
note: all colors must be given in the form #NNNNNN

Canvas Properties

for a complete list of canvas (i.e. the background) properties, please visit: http://flowplayer.org/documentation/configuration/plugins.html#display-properties
note: all colors must be given in the form #NNNNNN

Other Options For config.php
  • $ArchiveOrgPlayerROEenabled (default: true) - archive.org embed code will be automatically converted into appropriate PmWiki markup. If for some reason you want to prevent this, then set $ArchiveOrgPlayerROEenabled = false;
  • $linkToArchiveOrg - possible values: true, false, "ROE" (default: "true") - The FlowPlayer Context Menu doesn't currently work for files embedded from archive.org (possibly b/c it's not the pro version?), making it hard for a visitor to be able to locate and download these freely available files. By setting $linkToArchiveOrg = true; in config.php, the player will display a small html link to the archive.org page where the files are stored (http://www.archive.org/details/PageName). This text can be changed by setting $linkToArchiveOrg_text, and can be styled via the .archiveorglink class in your CSS file.
  • $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. Leaving $trackListing_enabled = true; (the default) 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:
  • 2011-02-21 - fixed FLV playback - SimpleEmbed was trying to play flv's using the audio settings instead of video settings; also created globals $ArchiveOrgAudioTypes & $ArchiveOrgVideoTypes to help archive.org figure out which player to use. overtones99
  • 2010-12-19 - added ArchiveOrgSimpleEmbed - Archive.org vids can now be embedded by simply using the URL for the file you want to include (rather than the full embed code). to disable, set $ArchiveOrgSimpleEmbed=false in config.php overtones99
  • 2010-08-29: major overhaul of the recipe, making it work with the updated version of flowplayer being used on the archive.org site overtones99
    • fixed ROEPattern for new archive.org player
    • **important** the $ArchiveOrgPlayerDefaultParams array is now broken up into several subarrays: basicPropertiesVideo, basicPropertiesAudio, clipProperties, controlbarProperties, autohideProperties, and canvasProperties; if you want to add a default property in config.php, one must now indicate which branch it's nested in, i.e. $ArchiveOrgPlayerDefaultParams['clipProperties']['autoBuffering'] = 'true';
    • the video- or audio-ID may now be presented either as (:archive.org mybasename/myfilename ...:) or as (:archive.org myfilename basename=mybasename ...:)
    • use the class .archiveorglink to style the archive.org link that appears when $linkToArchiveOrg is enabled; use $linkToArchiveOrg_text to set the text.
    • hexcheck has been disabled; just remember to precede your colors with a #
    • added basename= parameter; files can either be specified via (:archive.org [mybasename/file1, mybasename/file2] ... :), or via (:archive.org [file1, file2] basename=mybasename ... :)
  • 2010-01-02 - links in the context menu for the player don't currently work, so added $linkToArchiveOrg overtones99
  • 2009-12-21 - major upgrade overtones99
    • enabled many many FlowPlayer parameters not available in the initial release
    • changed default fs='true'
    • fixed bug with 'gloss' parameter
    • all hex-numbers now require a preceding '#' - admin can automatically check this by setting $hexcheck_enabled = true; in config
    • changed bgColor and bgGradient to backgroundColor & backgroundGradient
    • changed msg above tracklist
    • ability to suppress tracklist printout using $trackListing_enabled = false;
  • 2009-12-20 - initial release overtones99

TeacherTube

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:)

With this new version slideshare10042011.phpΔ of this recipe, you have only to provide the number that follows ".../embeded_code" at the script used to embed the presentation into a blog.

Example:

<div ...> ... <iframe src="http://www.slideshare.net/slideshow/embed_code/5582333" ... </div>
(:slideshare 5582333:)

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.

Examples:
(:audioo http://audioo.com/t/for-blinky-palermo--dog-star-orchestra/4d4e3e080544ffd/ :)

Optional parameters for Audioo include:

  • autostart - true or false (default: false)
  • volume - 0 to 100 (default: 80)

... and can be added following the url:

(:audioo http://audioo.com/t/for-blinky-palermo--dog-star-orchestra/4d4e3e080544ffd/ autostart=true:)

DailyMotion

For basic Daily Motion video, use dailymotion.phpΔ and add the following to config.php

   include_once("$FarmD/cookbook/dailymotion.php");

Put in the unique ID for the movie, not the whole URL, something like (:dailymotion x85gxs:) or (:dailymotion x85gxs_le-langage-des-banlieues-scredtv-ep_fun:) (http://www.dailymotion.com/video/x85gxs_le-langage-des-banlieues-scredtv-ep_fun)

Working example

Updates for other flash media

  • 2009-12-20: updated Audioo recipe; enabled ROEPattern; added Archive.org recipe
  • 2009-10-20: updated Audioo recipe; now accepts parameters 'volume' and 'autostart'
  • 2009-03-02: Added Audioo recipe (overtones99)
  • 2007-07-18: Added SlideShare recipe. (Robert)


Discussion for other flash media sites

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


Liveleak

The following code works,
but I don't know if it is secure.
I placed it at the end of swf-sites.php
liveleak.txtΔ
nikos 2010-04-02

The code for posting would be...

(:liveleak video_id:)

For example, for...

      www.liveleak.com/view?i=807_1205822827

type...

      (:liveleak 807_1205822827:)

end the result will be like this...

anarchy-domisi-ideon.awardspace.info/main/pmwiki.php?n=Main.ΚιθάραΜεΤοΚουτάλι

nikos 2010-04-02


file.qip.ru

Plenty of uselles code,
but it works!.
Place the code of fileqip.txt at the end of swf-sites.php
fileqip.txtΔ

The code for posting would be...

(:fileqip video_id:)

For example, for...

      file.qip.ru/embed/125176227/1a44fc37
      or
      file.qip.ru/file/125176227/1a44fc37/71464b3b_zlojj_uchitel.html

type...

      (:fileqip 125176227/1a44fc37:)

nikos 2010-04-08


Sandbox

This first two flash recipes have been enabled on this page.

%center% %width=400 height=400% Attach:fol.swf 

[[PmWiki.PmWiki|Attach:fol.swf]]

Attach:fol.swf


(:flash Attach:fol.swf width=300 height=200:)

(:flash width=300 height=200:)


(:flash Attach:tagcloud.swf width=300 height=200:)

(:flash width=300 height=200:)


See Also

  • Flowplayer - put FlowPlayer on your own server
  • Scribd - Embed Scribd documents & pdfs on a webpage

Contributors

User notes +2: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.

Edit - History - Print - Recent Changes - Search
Page last modified on October 04, 2011, at 08:12 AM