Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Responsive Video.js Test - JS Bin</title>
<!--[if IE]>
  <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<style>
  article, aside, figure, footer, header, hgroup, 
  menu, nav, section { display: block; }
</style>
  <style type="text/css">
    .container {
     width: 80%;
     margin: 0px auto;
    }
    video {
     max-width: 100%;
     height: auto;
    }
</style>
  <link href="http://vjs.zencdn.net/c/video-js.css" rel="stylesheet">
<script src="http://vjs.zencdn.net/c/video.js"></script>
</head>
<body>
  <div class="container">
    <video id="example_video_1" class="video-js vjs-default-skin" controls preload="none" poster="http://video-js.zencoder.com/oceans-clip.png"
        data-setup="{}">
      <source src="http://video-js.zencoder.com/oceans-clip.mp4" type='video/mp4' />
      <track kind="captions" src="captions.vtt" srclang="en" label="English" />
    </video>
  </div>
</body>
</html>
 
     // Once the video is ready
    _V_("example_video_1").ready(function(){
      
      // Store the video object
      var myPlayer = this; 
      // Make up an aspect ratio
      var aspectRatio = 264/640; 
      function resizeVideoJS(){
        var width = document.getElementById(myPlayer.id).parentElement.offsetWidth;
        myPlayer.width(width).height( width * aspectRatio );
      }
      
       // Initialize resizeVideoJS()
      resizeVideoJS();
      // Then on resize call resizeVideoJS()
      window.onresize = resizeVideoJS; 
    });
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers