mardi 5 novembre 2019

how to add bg video file in js using Django

I'm trying to add background video to my Django website using Bideo library but when I load the page it returns 404 error for my video file here's my code how can I point to bgvideo.mp4 in video directory?

/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';
      }
    });
  }());



Aucun commentaire:

Enregistrer un commentaire