Recent Changes - Search:

Cookbook

PmWiki

pmwiki.org

Flash

Summary: Embedding Flash movies
Version: 2006-10-28
Prerequisites: pmwiki-2.1.19
Status: stable
Maintainer:
Categories: Media Images Video

The flash.phpΔ file attached to this page appears to be corrupted. However, the swf.phpΔ file offers the same syntax

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

Question

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

Answer

Use either swf.phpΔ (below) or flash.phpΔ (further down) to enable flash files.

Place the swf.phpΔ script in your cookbook/ directory, add the line

    include_once('cookbook/swf.php');

to your config.php file, and any link ending in ".swf" will automatically be converted to HTML code for an embedded Flash animation.

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

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.


Alternative

  • flash.phpΔ is another script for flash embedding, using a different syntax.
  • Install the usual way in cookbook and add to config.php
       include_once("$FarmD/cookbook/flash.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

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

YouTube, Flickr Video, Google Video, and Vimeo

The same general method can be used to embed YouTube, Google Video, Flickr, and Vimeo videos.

swf-sites.phpΔ can be installed into the cookbook and add the following to config.php
  include_once("$FarmD/cookbook/swf-sites.php");

Then use (:youtube whatever:) markup where "whatever" is the funny unique code for the movie. So if your movie's url is

  http://youtube.com/watch?v=tiljk_MemVM

then you enter (:youtube tiljk_MemVM:) to embed. The same general rule applies to Google Video and Vimeo. So these are examples--always use the unique ID for the movie, not the whole url:

  (:googlevideo 4250622769233075850:)
  (:vimeo 128349:)

While the code for swf-sites.php is XHTML 1.0 compliant, you might find that you have trouble displaying in some browsers. In this case, you might want to try swf-sites2.phpΔ by Byron Lunz.

Flickr works differently because there are extra arguments. For Flickr, you need to extract the video id and the video secret from Flickr's embed page for that video. They are contained in the suggested embed code. Then you do (:flickrvid id=whatever secret=whatever:). You can also set the width and height using parameters width= and height=.

By Jabba Laci (July 20, 2008): the youtube part stopped working for me, so here is my correction: youtube2.phpΔ.

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

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(approve links)

Updates

  • 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-07-18: Added SlideShare recipe.
  • 2007-02-07: Updated YouTube and GoogleVideo recipes. They both now feature valid XHTML.
  • 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.

Contributors

Sandbox

This recipe has 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:)


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/(approve links). Thanks.LFS

Edit - History - Print - Recent Changes - Search
Page last modified on October 04, 2008, at 02:43 AM