diff options
Diffstat (limited to 'video.php')
-rw-r--r-- | video.php | 93 |
1 files changed, 52 insertions, 41 deletions
@@ -5,37 +5,48 @@ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script language="JavaScript"> <!-- -function MM_CheckFlashVersion(reqVerStr,msg){ - with(navigator){ - var isIE = (appVersion.indexOf("MSIE") != -1 && userAgent.indexOf("Opera") == -1); - var isWin = (appVersion.toLowerCase().indexOf("win") != -1); - if (!isIE || !isWin){ - var flashVer = -1; - if (plugins && plugins.length > 0){ - var desc = plugins["Shockwave Flash"] ? plugins["Shockwave Flash"].description : ""; - desc = plugins["Shockwave Flash 2.0"] ? plugins["Shockwave Flash 2.0"].description : desc; - if (desc == "") flashVer = -1; - else{ - var descArr = desc.split(" "); - var tempArrMajor = descArr[2].split("."); - var verMajor = tempArrMajor[0]; - var tempArrMinor = (descArr[3] != "") ? descArr[3].split("r") : descArr[4].split("r"); - var verMinor = (tempArrMinor[1] > 0) ? tempArrMinor[1] : 0; - flashVer = parseFloat(verMajor + "." + verMinor); - } - } - // WebTV has Flash Player 4 or lower -- too low for video - else if (userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 4.0; +function getFlashVersion() { + var activeXObj, plugins, plugin, result; - var verArr = reqVerStr.split(","); - var reqVer = parseFloat(verArr[0] + "." + verArr[2]); - - if (flashVer < reqVer){ - if (confirm(msg)) - window.location = "http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash"; + if (navigator.plugins && navigator.plugins.length > 0) { + plugins = navigator.plugins; + for (var i = 0; i < plugins.length && !result; i++) { + plugin = plugins[i]; + if (plugin.name.indexOf("Shockwave Flash") > -1) { + result = plugin.description.split("Shockwave Flash ")[1]; } } - } + } else { + plugin = "ShockwaveFlash.ShockwaveFlash"; + try { + activeXObj = new ActiveXObject(plugin + ".7"), result = activeXObj.GetVariable("$version") + } catch (e) {} + + if (!result) try { + activeXObj = new ActiveXObject(plugin + ".6"), result = "WIN 6,0,21,0", activeXObj.AllowScriptAccess = "always", result = activeXObj.GetVariable("$version") + } catch (e) {} + + if (!result) try { + activeXObj = new ActiveXObject(plugin), result = activeXObj.GetVariable("$version") + } catch (e) {} + + result && (result = result.split(" ")[1].split(","), result = result[0] + "." + result[1] + " r" + result[2]) + } + return result ? result : "0"; +} + +function checkFlashVersion(reqVerStr) { + var flashVer = getFlashVersion(); + flashVer = parseFloat(flashVer.split(" r")[0]); + + var verArr = reqVerStr.split(","); + var reqVer = parseFloat(verArr[0] + "." + verArr[2]); + + return flashVer >= reqVer; +} + +function supportsHTML5Video() { + return (typeof(document.createElement('video').canPlayType) != 'undefined'); } // --> </script> @@ -49,22 +60,22 @@ function MM_CheckFlashVersion(reqVerStr,msg){ <div> <script language="JavaScript"> <!-- - window.onload = function() { - var isHTML5Video = (typeof(document.createElement('video').canPlayType) != 'undefined'); - if (!isHTML5Video) { - MM_CheckFlashVersion('7,0,0,0','Content on this page requires a newer version of Macromedia Flash Player. Do you want to download it now?'); + if (!supportsHTML5Video()) { + if (!checkFlashVersion('7,0,0,0')) { + document.write('<P>Content on this page requires Macromedia Flash Player 7 or newer. <A HREF="http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash">Download now</A></P>'); + } else { + document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="342" height="291" id="FLVPlayer">'); + document.write('<param name="movie" value="FLVPlayer_Progressive.swf">'); + document.write('<param name="salign" value="lt">'); + document.write('<param name="quality" value="high">'); + document.write('<param name="scale" value="noscale">'); + document.write('<param name="FlashVars" value="&MM_ComponentVersion=1&skinName=Halo_Skin_3&streamName=<?= htmlentities("video/" . urlencode($_GET["v"] ?? "")); ?>&autoPlay=false&autoRewind=false">'); + document.write('<embed src="FLVPlayer_Progressive.swf" flashvars="&MM_ComponentVersion=1&skinName=Halo_Skin_3&streamName=<?= htmlentities("video/" . urlencode($_GET["v"] ?? "")); ?>&autoPlay=false&autoRewind=false" quality="high" scale="noscale" width="342" height="291" name="FLVPlayer" salign="LT" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">'); + document.write('</object>'); } - }; + } // --> </script> - <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="342" height="291" id="FLVPlayer"> - <param name="movie" value="FLVPlayer_Progressive.swf"> - <param name="salign" value="lt"> - <param name="quality" value="high"> - <param name="scale" value="noscale"> - <param name="FlashVars" value="&MM_ComponentVersion=1&skinName=Halo_Skin_3&streamName=<?= htmlentities("video/" . urlencode($_GET["v"] ?? "")); ?>&autoPlay=false&autoRewind=false"> - <embed src="FLVPlayer_Progressive.swf" flashvars="&MM_ComponentVersion=1&skinName=Halo_Skin_3&streamName=<?= htmlentities("video/" . urlencode($_GET["v"] ?? "")); ?>&autoPlay=false&autoRewind=false" quality="high" scale="noscale" width="342" height="291" name="FLVPlayer" salign="LT" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"> - </object> </div> </video> |