This one should do the trick. It's device independent. Even checks to see if 
h.264 video is supported.
HTH,

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Jack And The Giant</title>
<script type="text/javascript">
function hasFlash() {
        try {
          var AXO = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
          return AXO ? true:false;
        } catch(e){
          return navigator.mimeTypes ["application/x-shockwave-flash"] != 
undefined ? true:false;
        }       
};

function hasQt() {      
        if (navigator.plugins) {
                for (i=0; i < navigator.plugins.length; i++ ) {
                        if (navigator.plugins[i].name.indexOf ("QuickTime") >= 
0) { 
                                return true; 
                        }
                }
        }       
        if ((navigator.appVersion.indexOf("Mac") > 0) && 
                (navigator.appName.substring(0,9) == "Microsoft") && 
                (parseInt(navigator.appVersion) < 5) ) { 
                return true; 
        }
        return false;
};

function supports_video() {
  return !!document.createElement('video').canPlayType;
}

function supports_h264_baseline_video() {
  if (!supports_video()) { return false; }
  var v = document.createElement("video");
  return v.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"');
}

function loadVideo() {
        if( !hasFlash && supports_h264_baseline_video()) {
                /*HTML5 - h264*/
           videoCode = '<video id="jack_giant" width="100%" height="100%" 
controls preload="auto" poster="jack_giant.png" 
style="position:absolute;z-index:0;">\n'+
                '  <source src="jack_giant.mp4" type="video/mp4">\n'+ 
                '  </video>\n';
        } else if( !hasFlash && !supports_h264_baseline_video() && 
supports_video()) {
                /*HTML5*/
           videoCode = '<video id="jack_giant" width="100%" height="100%" 
controls preload="auto" poster="jack_giant.png" 
style="position:absolute;z-index:0;">\n'+
                '  <source src="jack_giant.ogg" type="video/ogg">\n'+ 
                '  <source src="jack_giant.webm" type="video/webm">\n'+ 
                '  </video>\n';
        } else if( !hasFlash && !supports_video() && hasQt ) {
                /*HTML4 QuickTime Embed - works on IE 7 and 8*/
                videoCode = '<object 
classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" 
codebase="http://www.apple.com/qtactivex/qtplugin.cab"; height="100%" 
width="100%" >\n'+
                '  <param name="src" value="jack_giant.mov" >\n'+
                '  <embed src="jack_giant.mov"'+
                '    height="100%"'+
                '    width="100%"'+
                '    type="video/quicktime"'+
                '    pluginspage="http://www.apple.com/quicktime/download/";'+
                '    style="position:absolute;z-index:0;"'+
                '    />\n'+
                '</object>\n';
        } else if( hasFlash ) {
                /*FLASH*/
           videoCode = '<object 
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"\n'+
                '  
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0"\n'+
 
                '  width="100%" height="100%" id="jack_giant" align="mc" 
style="position:absolute;z-index:0;">\n'+
                '  <param name="allowScriptAccess" value="sameDomain" />\n'+
                '  <param name="allowFullScreen" value="false" />\n'+
                '  <param name="movie" value="jack_giant.swf" />\n'+
                '  <param name="quality" value="high" />\n'+
                '  <param name="bgcolor" value="#fdef96" />' + 
                '  <param name="scale" value="noscale" />\n'+
                '  <param name="align" value="mc" />\n'+
                '  <param name="salign" value="mc" />\n'+
                '  <embed src="jack_giant.swf"' +
                '    bgcolor="#fdef96" width="100%" height="100%" '+ 
                '    quality="high"' +
                '    scale="noscale"' +
                '    name="jack_giant"' +
                '    align="mc"' +
                '    salign="mc"' +
                '    allowScriptAccess="sameDomain"' +
                '    allowFullScreen="false"' +
                '    type="application/x-shockwave-flash"'+
                '    style="position:absolute;z-index:0;"'+
                '  />\n'+
                '</object>\n';
        } else {
                videoCode = '<p>Your browser does not support HTML5 Video, 
QuickTime or Flash. Please upgrade your browser to the latest version or use a 
video compatible browser or download the <a 
href="http://www.adobe.com/go/getflash";>Flash Plugin</a> or the <a 
href="http://www.apple.com/quicktime/download/";>QuickTime Plugin</a> to view 
this video.</p>';
        }
        document.getElementById("video_player").innerHTML = videoCode;
}
</script>
</head>
<body>
<div id="video_player"></div>
<script type="text/javascript">
        loadVideo();
</script>
</body>
</html>

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com



On Jul 27, 2014, at 12:26 PM, Henrik Andersson <he...@henke37.cjb.net> wrote:

> This assumes that all mobile devices are incapable of Flash. That's
> patently false. It also ignores the issue of non-mobile devices that
> doesn't support Flash.
> 
> natalia Vikhtinskaya skriver:
>> Here is the code that I use (thank you Karl) and it works. Maybe it will be
>> useful for somebody. I try now to find way to change look of a controls
>> panel so the panel don't cover bottom of the video and text.
>> If anybody solved this task please give me advice. Thank you for all your
>> help.
> 
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to