1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58

media / test / data / encrypted_frame_size_change.html [blame]

<!DOCTYPE html>
<html>
  <body onload="load()">
    <p>Tests decoding and rendering encrypted video element that has a changing
      resolution.</p>
    <video width=320 controls></video>
    <video controls></video>
    <script src='eme_player_js/app_loader.js' type='text/javascript'></script>
    <script>
      var firstVideoSeek = false;
      var video_fixed_size = document.getElementsByTagName("video")[0];
      var video = document.getElementsByTagName("video")[1];
      var testConfig;

      function initTestConfig() {
        testConfig = new TestConfig();
        testConfig.loadQueryParams();
      }

      function load() {
        initTestConfig();
        loadVideo(video_fixed_size).then(function() {
          loadVideo(video);
        });
      }

      function loadVideo(video) {
        video.addEventListener('playing', function() {
          // Make sure the video plays for a bit.
          video.addEventListener('timeupdate', function() {
            if (video.currentTime > 1.0) {
              video.pause();
            }
          });
        });

        video.addEventListener('pause', function() {
          video.addEventListener('seeked', function() {
            if (!firstVideoSeek) {
              Utils.timeLog('One video seeked.');
              firstVideoSeek = true;
              return;
            }
            Utils.setResultInTitle('ENDED');
          });
          video.currentTime = 0.5;
        });

        video.addEventListener('canplay', oncanplay);

        var videoPlayer = PlayerUtils.createPlayer(video, testConfig);
        return videoPlayer.init()
            .then(function() { video.play(); })
            .catch(function() { Utils.failTest('Unable to play video.'); });
      }
    </script>
  </body>
</html>