video js

by zerrax

HTML

<link rel="stylesheet" href="https://vjs.zencdn.net/5-unsafe/video-js.css">
<script src="https://vjs.zencdn.net/5-unsafe/video.js"></script>
<!--
  Don't use the "5-unsafe" CDN version in your own code. It will break on you. 
  Instead go to videojs.com and copy the CDN urls for the latest version.
-->




  <video id="my_video_1" class="video-js vjs-default-skin" width="640px" height="267px" data-setup ='{}'
      controls preload="none" poster='http://content.bitsontherun.com/thumbs/3XnJSIm4-480.jpg'
      data-setup='{ "aspectRatio":"640:267", "playbackRates": [1, 1.5, 2] }'>
    <source src="//content.bitsontherun.com/videos/bkaovAYt-52qL9xLP.mp4" type="video/mp4">
    <source src="//content.bitsontherun.com/videos/bkaovAYt-27m5HpIu.webm" type="video/webm">
    <track label="pt" kind="captions" srclang="pt" src="https://playertest.longtailvideo.com/caption-files/sintel-en.srt" default="">
  </video>

CSS

/*
  Player Skin Designer for Video.js
  http://videojs.com

  To customize the player skin edit 
  the CSS below. Click "details" 
  below to add comments or questions.
  This file uses some SCSS. Learn more  
  at http://sass-lang.com/guide)

  This designer can be linked to at:
  https://codepen.io/heff/pen/EarCt/left/?editors=010
*/
.video-js {
  /* The base font size controls the size of everything, not just text.
     All dimensions use em-based sizes so that the scale along with the font size.
     Try increasing it to 15px and see what happens. */
  font-size: 16px;
  /* The main font color changes the ICON COLORS as well as the text */
  color: #cacaca;
}

/* The "Big Play Button" is the play button that shows before the video plays.
   To center it set the align values to center and middle. The typical location
   of the button is the center, but there is trend towards moving it to a corner
   where it gets out of the way of valuable content in the poster image.*/
.vjs-default-skin .vjs-big-play-button {
  /* The font size is what makes the big play button...big. 
     All width/height values use ems, which are a multiple of the font size.
     If the .video-js font-size is 10px, then 3em equals 30px.*/
  font-size: 4em;
  /* We're using SCSS vars here because the values are used in multiple places.
     Now that font size is set, the following em values will be a multiple of the
     new font size. If the font-size is 3em (30px), then setting any of
     the following values to 3em would equal 30px. 3 * font-size. */
  /* 1.5em = 45px default */
  line-height: 1.5em;
  height: 1.5em;
  width: 1.5em;
  /* 0.06666em = 2px default */
  border: 0.06666em solid #b7090b;
  /* 0.3em = 9px default */
  border-radius: 50%;
  display: none;
  /* Align center */
  left: 50%;
  top: 40%;
  margin-left: -0.75em;
  margin-top: -0.75em;
}

.video-js .vjs-play-control,
.video-js .vjs-remaining-time,
.video-js .vjs-volume-menu-button {
  border-right: 1px solid...

JavaScript

window.onload = function() {
        var anchors = document.getElementsByClassName('vjs-fullscreen-control');
        for(var i = 0; i < anchors.length; i++) {
            var anchor = anchors[i];
            anchor.onclick = function()
            {
              if(anchor.id.length)
              {
                anchor.id = "";
              }
              else
              {
                anchor.id = "fs";
              }
            }
        }
    }