jplayer / jPlayer

jPlayer : HTML5 Audio & Video for jQuery
http://jplayer.org/
Other
4.6k stars 1.47k forks source link

Flash player fallback not working in IE11 #188

Closed n-crrn closed 10 years ago

n-crrn commented 10 years ago

I have found that the flash fallback on IE 11 is not working, as jPlayer is not detecting the Flash plugin. The cause appears to be in _getFlashPluginVersion where the test "if (window.ActiveXObject)" is run (around line 2828 in jquery.jplayer.js in the GIT master). As described here (http://stackoverflow.com/questions/19638981/window-activexobject-difference-in-ie11), Microsoft has hidden that particular property from the DOM.

Changing that line to 'if (window.ActiveXObject !== undefined)' - as suggested in the above link - seems to solve the problem, and allows jPlayer to load the plugin and check its version.

happyworm commented 10 years ago

I'll take a closer look at this today. My brief test in the demo that prioritised Flash showed that the Flash was being used, but I will look more after lunch. I've been catching up with jPlayer after a short break.

Cheers for reporting the problem and for finding the fix!

happyworm commented 10 years ago

Reviewed this and I find that giving the following command in Win 7, IE11 console returns 11.9: $.jPlayer.prototype._getFlashPluginVersion()

Reading that post shows that the answers also say that: Starting with IE11, the navigator object supports plugins and mimeTypes properties. The MS Doc Ref

If you look at the code, then _getFlashPluginVersion() will look in the navigator.plugins if the window.ActiveXObject is falsey.

If the flash fallback is not working for you in IE11, then check your swfPath option is correct and check your Flash version is 10.1+

n-crrn commented 10 years ago

I run the website http://102point7fm.com.au, a community radio station website that plays a live MP3 stream from a Shoutcast server run by Voscast. This site has been working pretty well until recently (recent changes in early October did not touch the jPlayer related code), so I'm pretty sure the swfPath on the site and the flash version of my computers are right. :-P (For the record, on the machine I'm using for testing IE11, Adobe Update is reporting ActiveX version 10.3.183.10, Plug-in version 11.9.900.152).

http://102point7fm.com.au runs a copy of jPlayer with my suggested modification. I have set up http://102point7fm.com.au/jplayer-test/ using the version I've downloaded from GitHub (note that the JS file is not minimised, merely renamed). In addition, have set solution: "flash" and errorAlerts: true for this version (if I set solution: "flash,html", IE11 will attempt to load the stream from the Shoutcast server and barf on the ICY header, leaving nothing but a spinning wheel). If you wish to read my jPlayer control code - in case I'm doing something unusually silly - you will find it in js/radio.js for each site.

The test site works fine for Safari, Chrome, and IE11 operating in IE8 emulation. If IE11 is operating in its default document mode, I get the following: .... jPlayer 2.5.3 : id='jplayer_1' : Error! No solution can be found by jPlayer in this browser. Neither HTML nor Flash can be used. Review the jPlayer options: support and supplied. Context: {solution:'flash', supplied:'mp3'} .... I traced the problem to _getFlashPluginVersion using console.log statements previously.

As for IE11 changing the navigator object to support plugins and mimeTypes - all I can report is what I'm seeing. If it was just my Windows 7 computer having trouble, then I would have been able to sleep-in last Saturday morning :-P. Something doesn't appear to be working as advertised.

happyworm commented 10 years ago

Just checking in briefly to share my results.

Your test page that forces Flash worked for me in IE9. http://102point7fm.com.au/jplayer-test/

I was also able to run the command through the console.

$.jPlayer.prototype._getFlashPluginVersion()
11.9

Side note, your radio.js file is a bit sparse on semicolons. But not a problem unless you try and minify it... But in general you should really have them there, unless you claim to be an uber expert and are trying to save the bytes - but that can't be right since you're using long variable names without local var mapping within scope. Anywayz, off on a tangent.

Are you using a virtual box to test your IE11? If yes, test that audio is working on say YouTube or Flash page since bad audio drives cause problems with it.

When I visited the Flash version page, it said 11,9,900,170 installed and did not give any ActiveX info.

You say that others have the same problem - sorry about your Saturday lay in - and I wonder if there is anything in common. Are they all on the same corporate network?

Still finding this bizarre though, since IE11 adopted the W3C standard way of doing it and the code should be working with that. It is like your browser MUST use the ActiveXObject to detect for Flash, whereas it should be able to use the plugins.

For example, in my IE11 I can run this in the console:

navigator.plugins["Shockwave Flash"].description.replace(/.*\s(\d+\.\d+).*/, "$1");
"11.9"

Try running some of these commands in the console and report what your browser says.

FYI, I got these responses which were expected according to the MS doc and stackoverflow post:

typeof window.ActiveXObject
"undefined"
(window.ActiveXObject !== undefined)
true
n-crrn commented 10 years ago

Results from my IE11:

$.jPlayer.prototype._getFlashPluginVersion()
0
navigator.plugins["Shockwave Flash"].description.replace(/.*\s(\d+\.\d+).*/, "$1")
Unable to get property 'description' of undefined or null reference

However, going through the Flash version page is where I found something interesting. It is reporting that I have version "10,3,183,10" installed for IE11, and version "11,9,900,152" in Firefox. I have done nothing strange with the Adobe Flash plugin, and the installer reckoned it did another update yesterday morning. I'm suspecting that this has might be Adobe Flash not registering its plugin correctly, rather than any particular fault on IE11's part.

I can get access to another computer with the bug, but I will be a couple of days before I get access to it. I'm not using a virtual box for testing. The other computer I'll test is not on the same network. In fact, between my test machine, that one and a third that I was told about, the only things they have in common is that they run Windows 7 and are located in Queensland, Australia.

As for the lack of semicolons in the radio.js file - it was my first programming project after a long hiatus. To put it simply, I forgot them and got away with it - I wasn't an expert when I wrote it, and I'm still far from it. I do use semicolons and minifying these days though, so I am improving.

happyworm commented 10 years ago

That version of Flash on your IE setup is very only. These days it auto-updates. You should update your IE version to get a fair representation and if that works, then report the bug to Microsoft and Adobe.

Note that, IE has its own version of Flash, so install the flash through the visiting the update page in IE. Likewise, the mozilla browsers: Safari, Firefox and Opera use a different Flash install. And Chrome has its Flash built in for the foreseeable future.

n-crrn commented 10 years ago

Hmmm, I had thought the auto-updater would have taken care of the IE version as well as the others - I was wrong.

Are there any other tests you want me to try, given that this system is unlikely to be the only one that has gotten into this state? I will fix up the Flash installation once we're done.

For jPlayer to support down to version 10.1 of Flash in IE11, it appears to me that it will still need to test with "!== undefined" for the ActiveXObject, but to ensure healthy up-to-date IE11/Flash installations work, the "else if" statement will need to be changed to a separate "if (version == 0 && (navigator.plugins && navigator.mimeTypes.length > 0))" so that the plugins check is not skipped just because the ActiveXObject exists. Whether it's worth doing this though is your decision.

Given that we've identified the cause of the problem, I'm happy to consider the issue otherwise closed. Thank you for jPlayer, it is awesome software.