代码之家  ›  专栏  ›  技术社区  ›  user1026996

HTTP状态(已取消)当自动播放时,HTML视频元素上的循环为true

  •  2
  • user1026996  · 技术社区  · 7 年前

    我在玩HTML5视频,在网络活动中看到,每当视频循环时,它都会显示状态(已取消)。

    Status (canceled)

    我使用的属性是 preload="none" autoplay loop

    以下是一些示例HTML:

    <!DOCTYPE html> 
    <html lang="en">
    <head>
        <meta charset="utf-8">
        <title>fadeIn demo</title>
        <style>
    
        .video-container {
            display: none;
        }
        span {
            display: none;
        }
        </style>
        <script src="https://code.jquery.com/jquery-1.10.2.js"></script>
    </head>
    <body>
        <div style="text-align:center">
            <div class="still-container">
                <img src="https://s3.amazonaws.com/collectememe/storage/video_still/4101688e-14fa-4018-b296-1514dc0d202f.jpeg" width="560">
            </div>
            <div class="video-container">
                <video id="video1" width="560" preload="none" autoplay loop poster="test.jpeg">
                    <source src="https://s3.amazonaws.com/collectememe/storage/video/4101688e-14fa-4018-b296-1514dc0d202f.mp4" type="video/mp4">
                    Your browser does not support HTML5 video.
                </video>
            </div>
        </div> 
        <script> 
            var video = document.getElementById("video1"); 
            $( ".still-container" ).click(function() {
                $(".still-container").hide();
                $( ".video-container" ).fadeIn( 1000, function() {
                });
                return false;
            });
        </script> 
    </body> 
    </html>
    
    1 回复  |  直到 7 年前
        1
  •  0
  •   simsom    7 年前

    在匿名模式下打开Chrome,你会在网络活动中看到mp4。它与您在本地遇到的问题不同。我相信您在本地遇到的情况是,您没有运行web服务器来提供html文件,浏览器无法检查文件是否在循环中更改。