如何使用Django在js中添加bg视频文件

我正在尝试使用Bideo库将背景视频添加到我的Django网站中,但是当我加载页面时,它为我的视频文件返回404错误,这是我的代码 如何在视频目录中指向bgvideo.mp4?

    /mywebsite
        /ctrlcntr
            /static
                /video
                    bgvideo.mp4
                /js
                    Bideo.js
                    theme.js
    (function () {

        var bv = new Bideo();
        bv.init({
          // Video element
          videoEl: document.querySelector('#home_main_pic'),// Container element
          container: document.querySelector('body'),// Resize
          resize: true,// autoplay: false,isMobile: window.matchMedia('(max-width: 768px)').matches,playButton: document.querySelector('#play'),pauseButton: document.querySelector('#pause'),// Array of objects containing the src and type
          // of different video formats to add
          src: [
            {  
              src: '../video/bgvideo.mp4',type: 'video/mp4'
            },{
              src: '../video/bgvideo.webm',type: 'video/webm;codecs="vp8,vorbis"'
            }
          ],// What to do once video loads (initial frame)
          onLoad: function () {
            document.querySelector('#video_cover').style.display = 'none';
          }
        });
      }());
qzheng123 回答:如何使用Django在js中添加bg视频文件

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3160508.html

大家都在问