google-code-export / flowplayer-core

Automatically exported from code.google.com/p/flowplayer-core
2 stars 0 forks source link

flashembed.getVersion() returns wrong array for Flash > 9 #544

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Returns with Flash version 10.3.183: [10, 183]

For Flash > 9, the 2nd integer is relevant.

Fix (also attached):

Index: flashembed.js
===================================================================
--- flashembed.js   (revision 792)
+++ flashembed.js   (working copy)
@@ -107,7 +107,7 @@
            }

            ver = RE.exec(ver);
-           return ver ? [1 * ver[1], 1 * ver[3]] : [0, 0];
+           return ver ? [1 * ver[1], 1 * ver[(ver[1] > 9 ? 2 : 3)]] : [0, 0];
        },

        asString: function(obj) {

Original issue reported on code.google.com by blacktrashproduct on 8 May 2012 at 12:51

Attachments:

GoogleCodeExporter commented 9 years ago
See also: https://github.com/jquerytools/jquerytools/issues/710

Original comment by blacktrashproduct on 8 May 2012 at 12:54

GoogleCodeExporter commented 9 years ago
btw. what's the purpose of
1 * ver[1]
Is it something like parseInt(ver[1], 10)?

Original comment by blacktrashproduct on 8 May 2012 at 4:03

GoogleCodeExporter commented 9 years ago
Yea. That's exactly the purpose.

When version is "10" (string)  a comparison against "9" may fail. 

Original comment by tipii...@gmail.com on 9 May 2012 at 2:00

GoogleCodeExporter commented 9 years ago
then the line should probably read:

return ver ? [1 * ver[1], 1 * ver[(ver[1] * 1 > 9 ? 2 : 3)]] : [0, 0];

or you assign vars like major and minor first.

Anyway, you get the idea.

Original comment by blacktrashproduct on 9 May 2012 at 8:23

GoogleCodeExporter commented 9 years ago
oops, should be:
return ver ? [1 * ver[1], 1 * ver[(ver[1] * 1 > 9 ? 2 : 3)] * 1] : [0, 0];

Attachment contains the above (tested). Please check it in, so it is not 
forgotten.

Or tell me to create a more readable version.

Original comment by blacktrashproduct on 10 May 2012 at 7:30

Attachments:

GoogleCodeExporter commented 9 years ago
Committed: 
http://code.google.com/p/flowplayer-core/source/diff?spec=svn794&r=794&format=si
de&path=/flowplayer/trunk/src/javascript/flashembed.js

Original comment by anssip@gmail.com on 10 May 2012 at 12:04

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Please, consider my updates on this issue: 
https://github.com/jquerytools/jquerytools/pull/818

Original comment by babak.j...@gmail.com on 25 Jul 2012 at 12:59