Video Background - Version 2.6.3

Version Description

  • Fixed: ability to display just fallback image.
  • Fixed: if fallback image is present, but video files are not. The video will not load to save on browser page size.
Download this release

Release Info

Developer blakedotvegas
Plugin Icon 128x128 Video Background
Version 2.6.3
Comparing to
See all releases

Code changes from version 2.6.2 to 2.6.3

Files changed (4) hide show
  1. candide-vidbg.php +2 -2
  2. js/vidbg.js +6 -6
  3. js/vidbg.min.js +1 -1
  4. readme.txt +5 -1
candide-vidbg.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Video Background
4
  Plugin URI: https://pushlabs.co/documentation/video-background
5
  Description: WordPress plugin to easily assign a video background to any element. Awesome.
6
  Author: Push Labs
7
- Version: 2.6.2
8
  Author URI: https://pushlabs.co
9
  Text Domain: video-background
10
  Domain Path: /languages
@@ -19,7 +19,7 @@ if ( !defined( 'ABSPATH' ) ) {
19
  define( 'VIDBG_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
20
  define( 'VIDBG_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
21
  define( 'VIDBG_PLUGIN_BASE', plugin_basename(__FILE__) );
22
- define( 'VIDBG_PLUGIN_VERSION', '2.6.2' );
23
 
24
  /**
25
  * Install the plugin
4
  Plugin URI: https://pushlabs.co/documentation/video-background
5
  Description: WordPress plugin to easily assign a video background to any element. Awesome.
6
  Author: Push Labs
7
+ Version: 2.6.3
8
  Author URI: https://pushlabs.co
9
  Text Domain: video-background
10
  Domain Path: /languages
19
  define( 'VIDBG_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
20
  define( 'VIDBG_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
21
  define( 'VIDBG_PLUGIN_BASE', plugin_basename(__FILE__) );
22
+ define( 'VIDBG_PLUGIN_VERSION', '2.6.3' );
23
 
24
  /**
25
  * Install the plugin
js/vidbg.js CHANGED
@@ -138,11 +138,11 @@
138
  return;
139
  }
140
 
141
- // If VBP is mobile, display the poster image
142
  if ( base.isMobile() === true ) {
143
  $container.css( 'background-image', 'url(' + base.options.poster + ')' );
144
  } else {
145
- if ( base.options.type === 'self-host' && ( base.options.mp4 === '#' && base.options.webm === '#' ) ) {
146
  $container.css( 'background-image', 'url(' + base.options.poster + ')' );
147
  }
148
  }
@@ -154,8 +154,8 @@
154
  * @public
155
  */
156
  base.selfHostVideo = function() {
157
- // If VBP is mobile, quit
158
- if ( base.isMobile() === true ) {
159
  return;
160
  }
161
 
@@ -209,8 +209,8 @@
209
  * @public
210
  */
211
  base.resize = function() {
212
- // Check if mobile
213
- if ( base.isMobile() === true ) {
214
  return;
215
  }
216
 
138
  return;
139
  }
140
 
141
+ // If VB is mobile, display the poster image
142
  if ( base.isMobile() === true ) {
143
  $container.css( 'background-image', 'url(' + base.options.poster + ')' );
144
  } else {
145
+ if ( base.options.mp4 === '#' && base.options.webm === '#' ) {
146
  $container.css( 'background-image', 'url(' + base.options.poster + ')' );
147
  }
148
  }
154
  * @public
155
  */
156
  base.selfHostVideo = function() {
157
+ // If VB is mobile, or has no video links, quit
158
+ if ( base.isMobile() === true || ( base.options.mp4 === '#' && base.options.webm === '#' ) ) {
159
  return;
160
  }
161
 
209
  * @public
210
  */
211
  base.resize = function() {
212
+ // If VB is mobile, or has no video links, quit
213
+ if ( base.isMobile() === true || ( base.options.mp4 === '#' && base.options.webm === '#' ) ) {
214
  return;
215
  }
216
 
js/vidbg.min.js CHANGED
@@ -3,4 +3,4 @@
3
  * Copyright 2017 Push Labs
4
  * @preserve
5
  */
6
- !function($){$.vidbg=function(o,e){function i(o){var e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;o=o.replace(e,function(o,e,i,t){return e+e+i+i+t+t});var i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(o);return i?{r:parseInt(i[1],16),g:parseInt(i[2],16),b:parseInt(i[3],16)}:null}var t=this,n="Not implemented";t.$el=$(o),t.el=o,t.$el.data("vidbg",t),t.init=function(){t.options=$.extend({},$.vidbg.defaultOptions,e),t.container(),t.displayPoster(),t.selfHostVideo(),t.overlay()},t.isMobile=function(){return!!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)},t.container=function(){var o=t.$container=$('<div class="vidbg-container">');"static"===t.$el.css("position")&&t.$el.css("position","relative"),t.$el.css("z-index","1"),$(t.$el).prepend(o),t.$el.is("body")&&o.css({position:"fixed"})},t.overlay=function(){var o=t.$container,e=t.$overlay=$('<div class="vidbg-overlay">');!0===t.options.overlay&&e.css({background:"rgba("+i(t.options.overlayColor).r+", "+i(t.options.overlayColor).g+", "+i(t.options.overlayColor).b+", "+t.options.overlayAlpha+")"}),o.append(e)},t.displayPoster=function(){var o=t.$container;"#"!==t.options.poster&&(!0===t.isMobile()?o.css("background-image","url("+t.options.poster+")"):"self-host"===t.options.type&&"#"===t.options.mp4&&"#"===t.options.webm&&o.css("background-image","url("+t.options.poster+")"))},t.selfHostVideo=function(){if(!0!==t.isMobile()){var o=t.$container,e=t.$selfHostVideo=$('<video playsinline><source src="'+t.options.mp4+'" type="video/mp4"><source src="'+t.options.webm+'" type="video/webm"></video>');try{e.prop({autoplay:!0,loop:t.options.repeat,volume:1,muted:t.options.mute,defaultMuted:t.options.mute,playbackRate:1,defaultPlaybackRate:1})}catch(o){throw new Error("Not implemented")}e.one("canplaythrough.vidbg",function(){t.resize()}),e.one("playing.vidbg",function(){e.css({opacity:1})}),o.append(e)}},t.resize=function(){if(!0!==t.isMobile()){var o=t.$container,e=o.outerHeight(),i=o.outerWidth(),n;n=t.$selfHostVideo;var a,s;a=n[0].videoHeight,s=n[0].videoWidth,i/s>e/a?n.css({width:i+2,height:"auto"}):n.css({width:"auto",height:e+2})}},t.init()},$.vidbg.defaultOptions={mp4:"#",webm:"#",poster:"#",mute:!0,repeat:!0,overlay:!1,overlayColor:"#000",overlayAlpha:"0.3"},$.vidbg.instanceCollection={instance:[]},$.fn.vidbg=function(o){return this.each(function(){var e=$.data(this,"vidbg");e=new $.vidbg(this,o),e.index=$.vidbg.instanceCollection.instance.push(e)-1,$.data(this,"vidbg",e)})},$(document).ready(function(){$(window).on("resize.vidbg",function(){for(var o=$.vidbg.instanceCollection.instance.length,e=0,i;e<o;e++)(i=$.vidbg.instanceCollection.instance[e])&&i.resize()})})}(jQuery);
3
  * Copyright 2017 Push Labs
4
  * @preserve
5
  */
6
+ !function($){$.vidbg=function(o,i){function e(o){var i=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;o=o.replace(i,function(o,i,e,t){return i+i+e+e+t+t});var e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(o);return e?{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16)}:null}var t=this,n="Not implemented";t.$el=$(o),t.el=o,t.$el.data("vidbg",t),t.init=function(){t.options=$.extend({},$.vidbg.defaultOptions,i),t.container(),t.displayPoster(),t.selfHostVideo(),t.overlay()},t.isMobile=function(){return!!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)},t.container=function(){var o=t.$container=$('<div class="vidbg-container">');"static"===t.$el.css("position")&&t.$el.css("position","relative"),t.$el.css("z-index","1"),$(t.$el).prepend(o),t.$el.is("body")&&o.css({position:"fixed"})},t.overlay=function(){var o=t.$container,i=t.$overlay=$('<div class="vidbg-overlay">');!0===t.options.overlay&&i.css({background:"rgba("+e(t.options.overlayColor).r+", "+e(t.options.overlayColor).g+", "+e(t.options.overlayColor).b+", "+t.options.overlayAlpha+")"}),o.append(i)},t.displayPoster=function(){var o=t.$container;"#"!==t.options.poster&&(!0===t.isMobile()?o.css("background-image","url("+t.options.poster+")"):"#"===t.options.mp4&&"#"===t.options.webm&&o.css("background-image","url("+t.options.poster+")"))},t.selfHostVideo=function(){if(!0!==t.isMobile()&&("#"!==t.options.mp4||"#"!==t.options.webm)){var o=t.$container,i=t.$selfHostVideo=$('<video playsinline><source src="'+t.options.mp4+'" type="video/mp4"><source src="'+t.options.webm+'" type="video/webm"></video>');try{i.prop({autoplay:!0,loop:t.options.repeat,volume:1,muted:t.options.mute,defaultMuted:t.options.mute,playbackRate:1,defaultPlaybackRate:1})}catch(o){throw new Error("Not implemented")}i.one("canplaythrough.vidbg",function(){t.resize()}),i.one("playing.vidbg",function(){i.css({opacity:1})}),o.append(i)}},t.resize=function(){if(!0!==t.isMobile()&&("#"!==t.options.mp4||"#"!==t.options.webm)){var o=t.$container,i=o.outerHeight(),e=o.outerWidth(),n;n=t.$selfHostVideo;var a,s;a=n[0].videoHeight,s=n[0].videoWidth,e/s>i/a?n.css({width:e+2,height:"auto"}):n.css({width:"auto",height:i+2})}},t.init()},$.vidbg.defaultOptions={mp4:"#",webm:"#",poster:"#",mute:!0,repeat:!0,overlay:!1,overlayColor:"#000",overlayAlpha:"0.3"},$.vidbg.instanceCollection={instance:[]},$.fn.vidbg=function(o){return this.each(function(){var i=$.data(this,"vidbg");i=new $.vidbg(this,o),i.index=$.vidbg.instanceCollection.instance.push(i)-1,$.data(this,"vidbg",i)})},$(document).ready(function(){$(window).on("resize.vidbg",function(){for(var o=$.vidbg.instanceCollection.instance.length,i=0,e;i<o;i++)(e=$.vidbg.instanceCollection.instance[i])&&e.resize()})})}(jQuery);
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: blakedotvegas, pushlabs
3
  Tags: html5, video background, mp4, webm, responsive, shortcode, overlay, fullscreen background, fullscreen, html5 video background, metabox, blake wilson, loop, mute, unmute
4
  Requires at least: 4.2
5
  Tested up to: 4.8.2
6
- Stable tag: 2.6.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -84,6 +84,10 @@ You sure can! Simply go to the "Settings > Video Background" menu tab and check
84
 
85
  == Changelog ==
86
 
 
 
 
 
87
  = 2.6.2 =
88
  * Added: version to wp_register_style()
89
 
3
  Tags: html5, video background, mp4, webm, responsive, shortcode, overlay, fullscreen background, fullscreen, html5 video background, metabox, blake wilson, loop, mute, unmute
4
  Requires at least: 4.2
5
  Tested up to: 4.8.2
6
+ Stable tag: 2.6.3
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
84
 
85
  == Changelog ==
86
 
87
+ = 2.6.3 =
88
+ * Fixed: ability to display just fallback image.
89
+ * Fixed: if fallback image is present, but video files are not. The video will not load to save on browser page size.
90
+
91
  = 2.6.2 =
92
  * Added: version to wp_register_style()
93