Javascript - Воспроизведение видео - PullRequest
0 голосов
/ 28 ноября 2018

Моя проблема была в том, что когда видео длится 10 минут, оно воспроизводится снова с самого начала.Как я могу воспроизводить видео непрерывно, не воспроизводя видео снова, когда всплывающая реклама.Пожалуйста, помогите мне, спасибо

Код Javascript

<script>

  var player = document.getElementById('player');
  var supposedCurrentTime = 0;

  player.addEventListener('timeupdate', function() {

    if (!player.seeking) {
      supposedCurrentTime = player.currentTime;
    }});

  // prevent user from seeking
  player.addEventListener('seeking', function() {
    // guard agains infinite recursion:
    // user seeks, seeking is fired, currentTime is modified, seeking is fired, current time is modified, ....
    var delta = player.currentTime - supposedCurrentTime;
    if (Math.abs(delta) > 0.01) {
      console.log("Seeking is disabled");
      player.currentTime = supposedCurrentTime;
    }
  });
  // delete the following event handler if rewind is not required
  player.addEventListener('ended', function() {
    // reset state in order to allow for rewind
    supposedCurrentTime = 0;
  });


</script>

Мои объявления

<video
  oncontextmenu="return false;"
  src="../inflightapp/storage/app/public/movie_videos/<?php echo ''.$row2['movie_video'].''; ?>" <?php } ?>
  id="player"
  width="1px"
  controls
  controlbar=”no”
  controlsList="nodownload"
  ads = '{  
    "servers": 
      [
        {
          "apiAddress": "ads.php"
        }
      ],
    "schedule": 
      [
        <?php
          $data3 = mysqli_query($con,"SELECT * FROM ads");
          while($row3 = mysqli_fetch_array($data3)) {  
            echo '
              {
                "position": "'.$row3['roll'] .'",
                "startTime": "'.$row3['time'] .'"
              },'; 
           }
        ?>
      ]
  }'>
</video>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...