function setVideoBackground(n, t, i, r, u, f, e, o) {
  var l, s, h, c;
  try {
    l = this;
    r == 'msgbody' && (r = '.' + r);
    s = $(r);
    s.attr('data-expand') == 'background' && (s = s.parent());
    h = "<div class='background-video-container'>";
    h +=
      '<video muted = "true" playsinline autoplay="" loop="" style="visibility: visible;margin: auto;position: absolute;z-index: -1;top: 50%;left: 50%;transform: translate(-50%, -50%);width: auto;">';
    n && (h += '<source src="' + n + '" type="video/mp4">');
    t && (h += '<source src="' + t + '" type="video/webm">');
    u && (h += '<source src="' + u + '">');
    h += '</video>';
    h +=
      '<div class="video-controls">' +
      (e != 'off'
        ? '<i class="vb-play" style="display: none;"></i><i class="vb-stop"></i>'
        : '') +
      (f != 'off'
        ? '<i class="vb-volume-up" ></i><i class="vb-volume-off" style="display: none;"></i>'
        : '') +
      '</div></div>';
    s.prepend(h);
    i &&
      s
        .find('.background-video-container')
        .css('background-image', 'url(' + i + ')');
    (s.css('z-index') && s.css('z-index') != 'auto') || s.css('z-index', 1);
    s.css('position', 'relative');
    c = s.find('.background-video-container video');
    o == 'off' && c.removeAttr('loop');
    $('.background-video-container .vb-play')
      .unbind()
      .click(function () {
        var n = $(this).parent().parent().find('video');
        n.get(0).play();
        $(this).hide();
        n.parent().find(' .vb-stop').show();
      });
    $('.background-video-container .vb-stop')
      .unbind()
      .click(function () {
        var n = $(this).parent().parent().find('video');
        n.get(0).pause();
        $(this).hide();
        n.parent().find('.vb-play').show();
      });
    $('.background-video-container .vb-volume-up')
      .unbind()
      .click(function () {
        var n = $(this).parent().parent().find('video');
        n.prop('muted', !1);
        $(this).hide();
        n.parent().find('.vb-volume-off').show();
      });
    $('.background-video-container .vb-volume-off')
      .unbind()
      .click(function () {
        var n = $(this).parent().parent().find('video');
        $(this).hide();
        n.parent().find('.vb-volume-up').show();
        n.prop('muted', !0);
      });
    c[0].addEventListener(
      'playing',
      function (n) {
        n.target.removeEventListener(n.type, arguments.callee);
        var t = c.parent().parent();
        t.find('.background-video-container').css('background-image', 'none');
        $(this).css('visibility', 'visible').css('opacity', 1);
      },
      !1
    );
    c[0].addEventListener(
      'canplaythrough',
      function (n) {
        n.target.removeEventListener(n.type, arguments.callee);
        l.resize($(this));
      },
      !1
    );
    $(window).resize(function () {
      for (
        var t = $('.background-video-container video'), n = 0;
        n < t.length;
        n++
      )
        l.resize($(t[n]));
    });
    this.resize = function (n) {
      var r = n.parent('.background-video-container').parent(),
        u = n[0].videoHeight,
        f = n[0].videoWidth,
        i,
        t;
      typeof msgExpand == 'function' && msgExpand();
      i = r.outerHeight();
      t = r.outerWidth();
      t / f > i / u
        ? (t > $(window).width() && (t = $(window).width()),
          n.css({ width: t + 2, height: 'auto' }))
        : n.css({ width: 'auto', 'min-width': '100%', height: i + 2 });
    };
  } catch (a) {}
}
