[pmwiki-users] detecting flash player

Maria McKinley mariak at mariakathryn.net
Fri Apr 12 00:48:48 CDT 2013


Hi there,

I think I have discovered a simpler solution from this page:

http://perishablepress.com/embed-flash-and-video-via-the-object-tag/

I adapted his code a bit, and verified that this code works for showing a
png file if the flashplayer is not found:

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="400"
height="300"
        codebase="
http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,22,0
">
  <param name="movie" value="movie.swf" />
  <param name="bgcolor" value="#ffffff" />
  <param name="quality" value="high" />
  <!--[if !IE]>-->
    <object data="movie.swf" width="400" height="300"
type="application/x-shockwave-flash">
      <param name="pluginurl" value="
http://www.macromedia.com/go/getflashplayer" />
      <param name="bgcolor" value="#ffffff" />
      <param name="quality" value="high" />
      <img src="no-flash.gif" width="400" height="300" alt="Get Flash
Player" />
    </object>
  <!--<![endif]-->
</object>

Of course it shouldn't work with IE without Flash, but since it seems like
IE just comes with Flash now, I suspect this isn't an issue in any IE sort
of recent anyway. On a mac with chrome, safari and firefox and flash I get
just the flash video and on an iphone I get the png. The trick is to have
the img src tag inside the second object tag, otherwise you do get both.

I looked at the code for swf.php, and it looks like it shouldn't be
difficult to adapt. The code there uses the embed tag instead of the second
object. If you try to use the img trick within the embed tag, it shows both
the flash movie and the png. So, here is my idea:

SDV($SwfTagFmt,
  "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'
    codebase='
http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0'
>
    <param name='movie' value='\$LinkUrl' />
    <param name='quality' value='high' />
   <!--[if !IE]>-->
    <object data='\$LinkUrl' type='application/x-shockwave-flash'>
      <param name='pluginurl" value='
http://www.macromedia.com/go/getflashplayer' />
      <param name='quality' value='high' />
      <img src='\$AltUrl' />
    </object>
  <!--<![endif]-->
 </object>");

But, I just did the easy part, and, I have no idea what to do with the
actual pmwiki markup. I think there must be a way to make it so there is an
optional markup for flash so you could do something like this:

Attach:myflashfile.swf width=300 height=200 alt=my.png

But, now I am in over my head. Is this a crazy idea? For reference, this is
the rest of swf.php

Markup('swf', '<urllink',
  "/\\b(?>(\\L))([^\\s$UrlExcludeChars]+\\.swf)/e",
  "Keep(\$GLOBALS['LinkFunctions']['$1'](\$pagename,'$1','$2',NULL,'$1$2',
    \$GLOBALS['SwfTagFmt']), 'L')");

SDVA($WikiStyleAttr,array(
  'height' => 'img|object|embed',
  'width' => 'img|object|embed'));

?>

Thanks,
maria

On Thu, Apr 11, 2013 at 3:25 PM, tamouse mailing lists <
tamouse.lists at gmail.com> wrote:
>
> With all due respect, no, you can't actually detect it from within
> pmwiki. It's only known once you're actually in the user's browser,
> i.e., pmwiki has done all it can in rendering. You probably need to go
> with something like this: https://code.google.com/p/swfobject/
>
> On Thu, Apr 11, 2013 at 2:42 PM, Petko Yotov <5ko at 5ko.fr> wrote:
> > Yes, see this article:  http://blog.deconcept.com/2005/03/31/ .
> >
> > The Cookbook:Freemind recipe uses something like this. If Flash is
enabled
> > in the browser, a Flash object is inserted before a link.
> >
> > Petko
> >
> >
> > Maria McKinley writes:
> >>
> >> Is there any way to detect from pmwiki if there is a flash player in a
> >> browser? I'd like to show a flash movie if there is, and a gif if there
> >
> >
> >
> > _______________________________________________
> > pmwiki-users mailing list
> > pmwiki-users at pmichaud.com
> > http://www.pmichaud.com/mailman/listinfo/pmwiki-users
>
> _______________________________________________
> pmwiki-users mailing list
> pmwiki-users at pmichaud.com
> http://www.pmichaud.com/mailman/listinfo/pmwiki-users




--
Maria Mckinley
Programmer and System Administrator
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20130411/89c678a5/attachment.html>


More information about the pmwiki-users mailing list