Today is Friday, 19th April 2024

JPlayer – Change Default Solution Based on Browser Type


Though this will likely help nobody, I thought Iā€™d post this anyway.

I recently was installing JPlayer on a website and found that when the default solution was HTML / HTML5, the MP4 / M4V video being played would randomly stop after a certain amount of seconds. Similarly, Firefox had the same issue.

This was fixed by making FLASH the default solution, but doing that caused the video to be black / not show up for Internet Explorer ā€” IE10, IE9, IE8, and IE7 ā€” you would hear the audio but not see the video.

So I was in a bind. The default solution did not work for both browsers and would cause one to not be compatible.

I solved this by adding Web Browser detection / checking to the JavaScript. Specifically, it detects whether or not you are using Internet Explorer ā€” and if you are, then you are served a HTML version of the player. If you are on Firefox, Chrome, Safari, Opera, or any other browser, then the Adobe Flash version is the default.

Also in this version, I made JPlayer AutoPlay / AutoStart the video AND the volume is set to 40% (0.4) on load.

Pretty simple edits, but it can definitely help to customize JPlayer to your needs.

Leave a Reply


Affiliate Articles:

Amazon Deals