<?php

if ( empty($_GET['vid']) ) wp_die('Please insert a MP4 Video URL');
$ogg = '';
$webm = '';
$splash = '';
$controls = true;
$autoplay = '';
$ratio = 0.5625;

$mp4 = urldecode(base64_decode($_GET['vid']));
if ( !empty($_GET['webm']) ) $webm = urldecode($_GET['webm']);
if ( !empty($_GET['splash']) ) $splash = urldecode(base64_decode($_GET['splash']));
if ( !empty($_GET['ratio']) ) $ratio = urldecode($_GET['ratio']);
if ( isset($_GET['autoplay']) && $_GET['autoplay'] == 1 ) $autoplay = ' autoplay';
if ( isset($_GET['disable_control']) && $_GET['disable_control'] == 1 ) $controls = false;

?>
<!DOCTYPE html>
<!--[if IE 7]>
<html class="ie ie7" <?php language_attributes(); ?>>
<![endif]-->
<!--[if IE 8]>
<html class="ie ie8" <?php language_attributes(); ?>>
<![endif]-->
<!--[if !(IE 7) | !(IE 8)  ]><!-->
<html <?php language_attributes(); ?>>
<!--<![endif]-->
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Untitled Document</title>
<?php // Loads HTML5 JavaScript file to add support for HTML5 elements in older IE versions. ?>
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js" type="text/javascript"></script>
<![endif]-->
<style type='text/css'>
html, body, div, applet, object, iframe, audio, video {
	margin: 0;
	padding: 0;
	border: 0;
	font-size: 100%;
	vertical-align: baseline;
}
</style>
<link rel='stylesheet' id="flowplayer-css" href="//releases.flowplayer.org/5.4.3/skin/functional.css" type='text/css' media='all'>	
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type='text/javascript' src='//releases.flowplayer.org/5.4.3/flowplayer.min.js'></script>
<?php if ( !$controls ) : ?>
<style>
	.fp-controls, .fp-time {
		display: none;
	}
</style>
<?php endif; ?>
<?php if ( !empty($splash) ) : ?>
<style>
.flowplayer {
  background: #000 url("<?php echo $splash; ?>");
}
</style>
<?php endif; ?>
<body>
<div class="flowplayer functional" data-ratio="<?php echo $ratio; ?>" style="background-color:#000">
	<video<?php echo $autoplay; ?>>
		<source type="video/mp4" src="<?php echo $mp4; ?>">
		<?php if ( !empty($webm) ) : ?> <source type="video/webm" src="<?php echo $webm; ?>"><?php endif; ?>
	</video>
</div>
   
</body>
</html>
