HTML5 video player customization

by Ayyappan Sakthivadivel

HTML

<script src="code.jquery.com/jquery-1.11.3.js"></script>
<div class="container">
	<video>
		<source id="mp4" src="https://media.w3.org/2010/05/sintel/trailer.mp4" type="video/mp4">
    <source id="webm" src="https://media.w3.org/2010/05/sintel/trailer.webm" type="video/webm">
	  <source id="ogv" src="https://media.w3.org/2010/05/sintel/trailer.ogv" type="video/ogg">
  </video>
</div>

CSS

.player {
	width: 100%;
	background: #2a2a2a;
	box-sizing: border-box;
	height: 70px;
	-moz-box-sizing: border-box;
	float: left;
	font-family: Arial, sans-serif;
	padding: 0;
	margin-top: -5px;
	z-index: 2;
	opacity: 1;
	-webkit-transition: opacity 0.3s ease-in;
	transition: opacity 0.3s ease-in;
	-moz-user-select: none;
	-webkit-user-select: none;
	user-select: none;
}

.video {
	position: relative;
	margin: 0px auto;
}

.video:hover .player {
	opacity: 1;
}

.player .progress {
	width: 60%;
	height: 20px;
	border-radius: 5px;
	background: #676767;
	box-shadow: inset 0 -5px 10px rgba(0,0,0,0.1);
	float: left;
	cursor: pointer;
	margin: 24px 0 0 0;
	padding: 0;
	position: relative;
	font-variant: normal;
}

.player .progress-bar {
	background: #33b5d5;
	box-shadow: inset -30px 0px 69px -20px #89f6f5;
	border-radius: 5px;
	height: 100%;
	position: relative;
	z-index: 999;
	width: 0;
}

.player .button-holder {
	position: relative;
	left: 10px;
}

.player .progress-button {
	background: #fff;
	box-shadow: 0 0 20px rgba(0,0,0,0.3);
	border-radius: 30px;
	width: 20px;
	height: 20px;
	position: absolute;
	left: -20px;
	text-decoration: overline;
}


.player [class^="buffered"] {
	background: rgba(255,255,255,0.1);
	position: absolute;
	top: 0;
	left: 30px;
	height: 100%;
	border-radius: 5px;
	z-index: 1;
}

.player .play-pause {
	display: inline-block;
	font-size: 3em;
	float: left;
	text-shadow: 0 0 0 #fff;
	color: rgba(255,255,255,0.8);
    margin-left: 15px;
    margin-right: 15px;
    margin-top: 15px;
	cursor: pointer;
	font-variant: small-caps;
}

.player .play, .player .pause-button {
	-webkit-transition: all 0.2s ease-out;
}

.player .play .pause-button, .player .pause .play-button {
	display: none;
}

.player .pause-button {
	padding: 5px 2px;
	box-sizing: border-box;
	-moz-box-sizing: border-box;
	height: 34px;
}

.player .pause-button span {
	background: #fff;
	width: 8px;
	height: 24px;
	float: left;
	display: block;
}

.player .pause-button...

TypeScript

(function ($) {

	$.fn.videoPlayer = function (options) {


		var settings = {
			playerWidth: '0.95', // Default is 95%
			videoClass: 'video'  // Video Class
		}

		// Extend the options so they work with the plugin
		if (options) {
			$.extend(settings, options);
		}


		// For each so that we keep chainability.
		return this.each(function () {

			$(this)[0].addEventListener('loadedmetadata', function () {

				// Basic Variables 
				var $this = $(this);
				var $settings = settings;

				// Wrap the video in a div with the class of your choosing
				$this.wrap('<div class="' + $settings.videoClass + '"></div>');


				// Select the div we just wrapped our video in for easy selection.
				var $that = $this.parent('.' + $settings.videoClass);

				// The Structure of our video player
				{

					$('<div class="player">'
						+ '<div class="play-pause play">'
						+ '<span class="play-button">&#9658;</span>'
						+ '<div class="pause-button">'
						+ '<span> </span>'
						+ '<span> </span>'
						+ '</div>'
						+ '</div>'
						+ '<div class="play-pause play">'
						+ '<span class="play-button">&#9658;</span>'
						+ '<div class="pause-button">'
						+ '<span> </span>'
						+ '<span> </span>'
						+ '</div>'
						+ '</div>'
						+ '<div class="progress">'
						+ '<div class="progress-bar">'
						+ '<div class="button-holder">'
						+ '<div class="progress-button"> </div>'
						+ '</div>'
						+ '</div>'
						+ '</div>'
						+ '<div class="volume">'
						+ '<div class="volume-holder">'
						+ '<div class="volume-bar-holder">'
						+ '<div class="volume-bar">'
						+ '<div class="volume-button-holder">'
						+ '<div class="volume-button"> </div>'
						+ '</div>'
						+ '</div>'
						+ '</div>'
						+ '</div>'
						+ '<div class="volume-icon v-change-0">'
						+ '<span> </span>'
						+ '</div>'
						+ '</div>'
						+ '<div class="time">'
						+ '<span class="ctime">00:00</span>'
						+ '<span class="stime"> / </span>'
						+...