N8Solutions / swfobject

Automatically exported from code.google.com/p/swfobject
0 stars 0 forks source link

Flash player version detection failure when multiple Flash versions installed #198

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
This is a unique problem, but here goes:

For various testing purposes, I installed an old version of Netscape.  It 
came bundled with Flash 5.x (ancient, I know).  Then I installed Safari 
for Windows after that; what occurred is Safari "imported" that old Flash 
5.x plugin for use, along with importing a newer Flash 9.x plugin for use 
(from a different browser...I have many on the same box).  When I go and 
look at the plugin information through Safari, it lists both a 5.x and a 
9.x Flash player installed.  Wacky.

Then, when I run swfobject.hasFlashPlayerVersion("6.0.65"), it returns 
false--presumably because it parsed the .plugins DOM items and found the 
5.x player plugin first.  If I use the old-school object+embed approach to 
load up a v6 compiled SWF manually, it runs just fine...meaning somehow 
Safari is able to figure out to use the v9 player even though the v5 
player is installed (I'm assuming the v5 player will puke on my v6 
compiled SWF).

I assume the idea would be to enhance the MIME type code a bit to see if 
there is more than one plugin available for x-shockwave-flash, and find 
the more recent version of all of those installed.  But this may be too 
much of a corner case to consider; you're call.

Original issue reported on code.google.com by jeff.for...@gtempaccount.com on 20 Oct 2008 at 8:53

GoogleCodeExporter commented 8 years ago
Thanks for the issue report. We have tried to reproduce the multiple install 
issue
several times, however never managed to reproduce it in the past. Auto-import 
is the
missing puzzle piece :-)

This is a duplicate of issue report #180:
http://code.google.com/p/swfobject/issues/detail?id=180

Copied over:

====

original report by MattGiger:
http://groups.google.com/group/swfobject/browse_thread/thread/87d89c47b2178eae

====

After a lot of debugging I've found that it is possible to have more
than one version of flash installed on a Mac laptop using Safari for
some reason. This may happen on other Macs and with other browsers,
but the flash player detection routine in SWFObject fails to detect
the correct version. I've made a small modification to the ua
function() section that will correctly detect the most recent player.

Here is the diff for the new version 2.1:
40,45c40,52
<                    d = nav.plugins[SHOCKWAVE_FLASH].description;
<                    if (d && !(typeof nav.mimeTypes != UNDEF &&
nav.mimeTypes[FLASH_MIME_TYPE] && !
nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { //
navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin
indicates whether plug-ins are enabled or disabled in Safari 3+
<                            d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
<                            playerVersion[0] =
parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
<                            playerVersion[1] =
parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"),
10);
<                            playerVersion[2] = /r/.test(d) ?
parseInt(d.replace(/^.*r(.*)$/,
"$1"), 10) : 0;
---

>                    for(var i=0;i<nav.plugins.length;++i) {
>                            d = nav.plugins[i].description;
>                            if (d && !(typeof nav.mimeTypes != UNDEF &&
nav.mimeTypes[FLASH_MIME_TYPE] &&
!nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { //
navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin
indicates whether plug-ins are enabled or disabled in Safari 3+
>                                    d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
>                                    var pv0 =
parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
>                                    var pv1 =
parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
>                                    var pv2 = /r/.test(d) ?
parseInt(d.replace(/^.*r(.*)$/, "$1"), 10) : 0;
>                                   
if((pv0>playerVersion[0])||(pv0==playerVersion[0]&&pv1>playerVersion[1])||(pv0==
playerVersion[0]&&pv1==playerVersion[1]&&pv2>playerVersion[2]))
{
>                                            playerVersion[0] = pv0;
>                                            playerVersion[1] = pv1;
>                                            playerVersion[2] = pv2;
>                                    }
>                            }

Hope this helps other people with Flash detection on the Mac.

====

I can't reproduce the issue.

My tests include:
- Mac OSX 10.4.11
- Firefox 3.0
- Safari 3.1

Test sequence:
- uninstall fp 9.124 using Adobe uninstaller
- install fp 8.24
- install fp 9.16
- install fp 9.115
- install fp 9.124
- install fp 9.16
- install fp 9.124

During every version I checked which version was detected by Flash and 
SWFObject, and
which version(s) was installed by the 2 browsers.

However no anomalies.

I can imagine that this can be caused by potential plugin switcher software or
corrupt installers (see FAQ). 

Because I can't reproduce it AND it's the first time I have heard of this 
issue, I am
going to close it for now. 

If anyone can come with more info or can reproduce this I am happy to reopen the
investigation.

Original comment by bobbyvandersluis on 21 Oct 2008 at 8:22

GoogleCodeExporter commented 8 years ago
I've been a user of old flashObject.js for several years with out a hitch until 
recently.  Adobe's 10.0.12.36 release has caused detection problems on the Mac 
with 
the older script.  Updating to the new swfObject 2.1 seemed to be an obvious 
solution, however it introduced a new set of issues which I didn't expect.  It 
broke 
detection on the Mac under Internet Explorer (at least using the dynamic 
method).  
The static method seems a step backwards from what the flashobject.js did 
automatically years ago, and I still had issues with it under IE for the Mac.  
While 
I understand IE for the Mac is long gone, there are still a lot of older 
machines in 
poor school districts using it so I've been working to come up with a work 
around.

I've moved the ua() function into flashObject and I've seemed to address the 
problems with Flash 10 detection, and I've also had success under IE 5.0 for 
Mac OS 
9.2.  At this point, I'm having trouble detecting the Flash Version on IE 5.2 
on Mac 
OSX 10.4.11 which is reporting a version of 0.  I'm going to try this code and 
see 
if it makes a difference.  

Original comment by jpwalte...@gmail.com on 31 Oct 2008 at 2:57

GoogleCodeExporter commented 8 years ago
The original resolution by MattGiger doesn't make any sense. There will only be 
one
navigator.plugins["Shockwave Flash"] entry available, so the returned value will
always be the only description string available. Also
navigator.mimeTypes["application/x-shockwave-flash"] cannot be utilized to get 
any
additional information.

Currently I am investigating a new technique to improve version detection on 
non IE
browsers. Cross-link: http://code.google.com/p/swfobject/issues/detail?id=155 

Original comment by bobbyvandersluis on 31 Oct 2008 at 4:43

GoogleCodeExporter commented 8 years ago
I've found that you can induce this situation pretty easily with Safari on 
Windows.  
Just take the npswf32.dll file from a version of Flash other than what is 
currently 
listed as installed in Sarari (look via Help -> Installed Plug-ins), and copy 
that 
DLL to \program files\safari\plugins.  I actually renamed it npswf32_2.dll just 
so I 
can tell the various DLLs apart.

Then, restart Safari and again look at the installed plug-ins list.  Both 
versions 
of Flash should be listed.  This trick also works with Firefox on Windows (copy 
to 
\program files\mozilla firefox\plugins), but does NOT work for Opera on Windows.

Original comment by jeff.for...@gtempaccount.com on 31 Oct 2008 at 5:58

GoogleCodeExporter commented 8 years ago
bobbyvandersluis said:

"The original resolution by MattGiger doesn't make any sense. There will only 
be one
navigator.plugins["Shockwave Flash"] entry available, so the returned value will
always be the only description string available."

Yes, that's true.  But if you index access into the plugins array (which is 
what 
MattGiger did), you can find multiple plugins that happen to have the same name.

E.g. here's some javascript:
var d1 = navigator.plugins["Shockwave Flash"].description;
var d2 = '';
for(var i=0; i<navigator.plugins.length; i++){
    var p = navigator.plugins[i];
    if(p.name == "Shockwave Flash")
        d2 += i + ": " + p.description + "<br>\r\n";
}
document.write("Direct:<br>" + d1 + "<br><br>");
document.write("Index:<br>" + d2);

And here's what my test Safari setup displays when executed:
Direct:
Shockwave Flash 9.0 r124

Index:
4: Shockwave Flash 9.0 r124
9: Shockwave Flash 8.0 r42

I suspect that when you do nav.plugins["foo"], it just enumerates over 
nav.plugins 
starting at zero index until it finds the first name match for "foo" and 
returns it.

Anyways, you could always try to detect this corner case directly:
var count=0;
for(var i=0; i<navigator.plugins.length; i++){
    if(navigator.plugins[i].name == "Shockwave Flash")
        count++;
}

If count > 1, then you have to invoke extra steps to figure out what is the 
newest/largest version number installed.

The real million dollar question is: how does the browser know which 
dll/version of 
Flash to run?  If Flash v6 and v9 are installed, what happens with a v8 SWF?  
Does 
the browser somehow automatically know to always ignore v6 plugin and use v9 
for 
everything?  And when you write out an object to the DOM to test the Flash 
version 
(which is the new technique you were talking about), without a SWF to know what 
version is needed, how would the browser choose between using the v6 plugin vs. 
the 
v9 plugin to attach to the (initial?) handling of that DOM object (in order to 
return the version)?

Murky waters, indeed.

Original comment by jeff.for...@gtempaccount.com on 31 Oct 2008 at 6:22

GoogleCodeExporter commented 8 years ago
Not to keep spamming this thread, but attached is some PNG eyecandy of the 
problem 
in action.

Original comment by jeff.for...@gtempaccount.com on 31 Oct 2008 at 6:49

Attachments:

GoogleCodeExporter commented 8 years ago
After a bit more testing, it seems it is a bit non-deterministic to know which 
version of Flash will be used if the browser is loaded with more than one Flash 
plugin.

I took Safari and loaded it with Flash 6.x, 8.x, and 9.x (at the same time) to 
see 
what would happen.  A screenshot of the resulting chaos is attached.  8.x is 
what 
actually got used (debunking the idea that you can just iterate over .plugins 
and 
find the highest version number installed and go with it).

Overall, it seems the only true way to know what version of Flash player will 
be 
loaded is to invoke the player and see.  That supports your notion of using an 
approach like that discussed in bug ID 155.

Original comment by jeff.for...@gtempaccount.com on 31 Oct 2008 at 7:41

Attachments:

GoogleCodeExporter commented 8 years ago
I'll further investigate this issue for:
1. Cause - what are normal use cases to reproduce this corrupt setup
2. The corrupt setup - who's bug is this really? Adobe, Mozilla, Apple?
3. The workaround - I think we are already in the right direction here, I mean 
the
navigator.plugins method will work fine for 99.9% of all users, so a correction 
for
this issue and corrupt installers (where the description string itself is wrong,
which at times causes issues to a way bigger audience) is a nice workaround

Original comment by bobbyvandersluis on 1 Nov 2008 at 9:23

GoogleCodeExporter commented 8 years ago
And before I forget, thanks for the elaborate feedback :-)

Original comment by bobbyvandersluis on 1 Nov 2008 at 9:27

GoogleCodeExporter commented 8 years ago

Original comment by bobbyvandersluis on 3 Nov 2008 at 12:26

GoogleCodeExporter commented 8 years ago
Bobbyvandersluis wrote:

"Cause - what are normal use cases to reproduce this corrupt setup"

I figure I'll take a shot at least stating my perspective, and then I'll shutup 
and 
let you decide to do whatever you feel is necessary. :)

Basically, I agree with the CEO of Opera in his recent interview 
(http://gigaom.com/2008/10/30/gigaom-interview-ceo-of-opera-jon-s-von-tetzchner/
) 
regarding the affect of Chrome on Opera's market standings.  The simple fact is 
that 
people are becoming more and more aware that there are alternative browsers out 
there, and people are experimenting with them.  We no longer have the classic 
situation where a Windows user will have IE and perhaps one alternative 
(Safari, 
Firefox, -OR- Opera); people understand they have a choice.  Every time they 
hear 
about a new browser offering a different/unique experience (Flock, Seamonkey, 
Ubiquity, etc.), they may run out and give it a try.  Web browsers are becoming 
typical everyday desktop applications, and people have more than one installed 
these 
days.

So what does that mean?  Well, we are likely to start encountering this 
multiple 
Flash version issue more and more (side note: we'll likely start seeing it with 
other plugins too).  It is in the best interest of browsers to try to give the 
user 
a thorough experience out-of-the-box, and that means making sure everything the 
user 
could do before (via previously installed plugins) can also be done now.  So 
the 
idea of grabbing plugins from already installed browsers and copying them over 
is a 
fairly reasonable approach to help the user transition their experience (and 
functional expectations) over to the new browser.

I humbly suggest that this multiple Flash version issue is going to get more 
prominent as time goes on.  Plugin writers could work to solve the problem this 
problem by keeping the core functionality within a separate DLL in a fixed 
location, 
and then deploying only simple DLL redirection wrappers as the actual plugin.  
That 
way, updates happen to the fixed DLL while browsers are free to steal/copy the 
wrapper amongst each other all they want, to no ill effect.  However, that is 
obviously not going to help what's already deployed in the world.

So, yeah.  That's my take.  Time will tell I suppose.

Thanks,
- Jeff

Original comment by jeff.for...@gtempaccount.com on 3 Nov 2008 at 3:49

GoogleCodeExporter commented 8 years ago
Fix is include in SWFObject 2.2 alpha6, see also
http://code.google.com/p/swfobject/issues/detail?id=155

Original comment by bobbyvandersluis on 1 Dec 2008 at 3:40

GoogleCodeExporter commented 8 years ago
Included in the SWFObject 2.2 beta1 release

Original comment by bobbyvandersluis on 16 Apr 2009 at 3:05

GoogleCodeExporter commented 8 years ago
I think I have this problem 'in the wild' with Linux Chrome 4.0.249.30 on 
xubuntu.

libflashplayer.so crashes (dead plugin icon) on a flash-containing page 100% of 
the 
time, and about:plugins reports three instances of that file, with two 
different 
version numbers. Flash works in Firefox and reports the most recent version on 
http://kb2.adobe.com/cps/155/tn_15507.html

It's possibly indirectly caused by both apt-getting flashplugin-nonfree and 
directly 
downloading Flash Player from Adobe.

Original comment by dave.mc...@gmail.com on 14 Dec 2009 at 2:12

Attachments:

GoogleCodeExporter commented 8 years ago
Deleting the file from ~/.mozilla/plugins [and /opt/google/chrome/plugins, 
where I had 
put it during attempts to fix problem] has resolved the issue for me (and not 
impacted 
on Firefox), demonstrating that this remains an issue. (The two v9 flash plugin 
entries have disappeared from about:plugins, too.)

Original comment by dave.mc...@gmail.com on 14 Dec 2009 at 2:25