Как добавить BG видео файл в JS, используя Django - PullRequest
0 голосов
/ 05 ноября 2019

Я пытаюсь добавить фоновое видео на свой веб-сайт Django, используя библиотеку Bideo, но когда я загружаю страницу, она возвращает ошибку 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';
          }
        });
      }());
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...