【问题标题】:lightbox.js html5 video not playing video. what did I do wrong?lightbox.js html5 视频不播放视频。我做错了什么?
【发布时间】:2020-05-03 13:34:45
【问题描述】:

我正在尝试让此页面上的示例专门工作,因为我的视频文件存储在我的网络服务器上。

https://sachinchoolur.github.io/lightgallery.js/demos/html5-videos.html

这是我的 html 文件。我按照灯箱 github 页面上的说明进行操作,但我一定错过了什么,因为视频无法播放。

<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="css/lightgallery.css">
<link href="css/video-js.css" rel="stylesheet">
</head>
<body>
    <!-- Hidden video div -->
    <div style="display:none;" id="video1">
        <video class="lg-video-object lg-html5 video-js vjs-default-skin" controls preload="none">
            <source src="archive/devon_rayford/20200501.tom_hanks_gone.Q_dx99JcxT8.mp4" type="video/mp4">
             Your browser does not support HTML5 video.
        </video>
    </div>
    <div style="display:none;" id="video2">
        <video class="lg-video-object lg-html5 video-js vjs-default-skin" controls preload="none">
            <source src="archive/devon_rayford/20200501.Tom_Hanks_is_really_gone.Hrx1YtkpfPY.mp4" type="video/mp4">
             Your browser does not support HTML5 video.
        </video>
    </div>

    <!-- data-src should not be provided when you use html5 videos -->
    <ul id="video-gallery">
      <li data-poster="archive/devon_rayford/thumbnails/20200501.tom_hanks_gone.Q_dx99JcxT8.jpg" data-sub-html="video caption1" data-html="#video1" >
          <img src="archive/devon_rayford/thumbnails/20200501.tom_hanks_gone.Q_dx99JcxT8.jpg" />
      </li>
      <li data-poster="archive/devon_rayford/thumbnails/20200501.Tom_Hanks_is_really_gone.Hrx1YtkpfPY.jpg" data-sub-html="video caption2" data-html="#video2" >
          <img src="archive/devon_rayford/thumbnails/20200501.Tom_Hanks_is_really_gone.Hrx1YtkpfPY.jpg" />
      </li>
    </ul>
<script src="js/jquery-3.5.0.min.js"></script>
<script src="js/lightgallery.min.js"></script>
<script src="js/video.js"></script>
<!-- Include lg-video -->
<script src="js/lg-video.min.js"></script>

<!-- Include other lightgallery plugins (Optional) -->
<script src="js/lg-thumbnail.min.js"></script>

<script>
lightGallery(document.getElementById('lightgallery')); 
lightGallery(document.getElementById('video-gallery'), 
{
    videojs: true
});

lightGallery(document.getElementById('html5-videos')); 

$('#html5-videos').lightGallery();
$('#video-gallery').lightGallery({ 
    videojs: true
});

</script>

</body>
</html> 

我做错了什么?

【问题讨论】:

    标签: javascript html jquery video lightbox


    【解决方案1】:

    看起来像 lightgallery.min.js 的缩小版本有一些未知错误。我试过用正版,效果很好。

    <script src="https://cdn.jsdelivr.net/npm/lightgallery.js@1.1.3/dist/js/lightgallery.js"></script>
    
    <script src="https://cdn.rawgit.com/sachinchoolur/lg-video.js/master/dist/lg-video.js"></script>
    

    我还没试过jQuery版本。

    Demo

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-11-04
      • 2018-09-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多