title: Problems with the currentTime attribute of HTML5 video
body: <p>I ran into a problem with the currentTime attribute of HTML5 video. My little programm serves different videos (different resolutions) depending on device resolution. I want to check the device resolution after every window.onload, window.resize and window.orientationchange-Event. After those Events it's possible that a new video is served (with a different more appropriate resolution). I don't want to start the video at second 0 again and therefore I tried to capture the currentTime of the video right before the event. My solution works well in IE 10. But all other browsers fail...I don't know why..</p>
  
  <p>Please don't be mean...i'm very new to all of this web stuff and I honestly try my best.</p>
  
  <p>Hope anyone of you can help me...</p>
  
  <p>Here's my code:
      </p>
  
  <p>
      </p>
  
  <pre><code>    &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;  
      &lt;meta name="viewport" content="width=device-width, initial-scale=1, maximum-    scale=1"&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  
      &lt;video id=videoPlayer controls="controls"&gt; &lt;/video&gt;
  
  
  &lt;script&gt;
  
  var pixelRatio = 1.0;
  var availScreenWidth;
  var availScreenHeight;
  var videoResolution;
  var type;
  var video = document.getElementById('videoPlayer');
  var pos;
  
  window.onload = updateVideo;
  window.orientationchange = updateVideo;
  window.onresize = updateVideo;
  
  function updateVideo(){   
  
      pos = video.currentTime;
  
      updateResolution();
  
      if(availScreenWidth &lt;800){
          videoResolution = '640x360';
      }
      if(availScreenWidth &gt;=800 &amp;&amp; availScreenWidth &lt; 1137){
          videoResolution = '960x540';
      }
      if(availScreenWidth &gt;=1137 &amp;&amp; availScreenWidth &lt; 1367){
          videoResolution = '1280x720';
      }
      if(availScreenWidth &gt;=1367 &amp;&amp; availScreenWidth &lt; 1681){
          videoResolution = '1600x900';
      }
      if(availScreenWidth &gt;= 1681){
          videoResolution = '1920x1080';
      }
  
      if (video.canPlayType("video/webm") == 'maybe' || video.canPlayType("video/webm") == 'probably') {
          type = '.webm';
      }
      else if (video.canPlayType("video/mp4") == 'maybe' || video.canPlayType("video/mp4") == 'probably') {
          type = '.mp4';
      }
  
     video.src = videoResolution + type;
  
      video.addEventListener('loadedmetadata', function() {
          video.currentTime = pos;
          video.play();}, false);
  
      }
  
      video.load();
  
  
  function updateResolution(){
  
      if (window.devicePixelRatio){
          pixelRatio = window.devicePixelRatio;
      }
      availScreenWidth = document.documentElement.clientWidth * pixelRatio;
      availScreenHeight = document.documentElement.clientHeight * pixelRatio;
  
  }
  
  
  
  &lt;/script&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>