Today is Friday, 27th December 2024

Posts Tagged ‘code’

JPlayer – Change Default Solution Based on Browser Type

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.



Sponsored

Affiliate Articles:

Amazon Deals

Top