Video Background - Version 2.7.1

Version Description

  • Fixed: Remove tap to unmute button when video background can't be played
Download this release

Release Info

Developer pushlabs
Plugin Icon 128x128 Video Background
Version 2.7.1
Comparing to
See all releases

Code changes from version 2.7.0 to 2.7.1

Files changed (4) hide show
  1. candide-vidbg.php +2 -2
  2. js/vidbg.js +5 -0
  3. js/vidbg.min.js +1 -1
  4. readme.txt +5 -2
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.7.0
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.7.0' );
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.7.1
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.7.1' );
23
 
24
  /**
25
  * Install the plugin
js/vidbg.js CHANGED
@@ -131,6 +131,11 @@
131
  */
132
  base.tapToUnmute = function() {
133
 
 
 
 
 
 
134
  // If the tap to unmute option is disabled, quit.
135
  if ( base.options.tapToUnmute === false ) {
136
  return;
131
  */
132
  base.tapToUnmute = function() {
133
 
134
+ // If Video Background is mobile, don't display the tapToUnmute button
135
+ if ( base.isMobile() === true ) {
136
+ return;
137
+ }
138
+
139
  // If the tap to unmute option is disabled, quit.
140
  if ( base.options.tapToUnmute === false ) {
141
  return;
js/vidbg.min.js CHANGED
@@ -3,4 +3,4 @@
3
  * Copyright 2017 Push Labs
4
  * @preserve
5
  */
6
- !function($){$.vidbg=function(o,e){function t(o){var e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;o=o.replace(e,function(o,e,t,i){return e+e+t+t+i+i});var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(o);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null}var i=this;i.$el=$(o),i.el=o,i.$el.data("vidbg",i),i.init=function(){i.options=$.extend({},$.vidbg.defaultOptions,e),i.container(),i.displayPoster(),i.selfHostVideo(),i.tapToUnmute(),i.overlay()},i.isMobile=function(){return!!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)},i.container=function(){var o=i.$container=$('<div class="vidbg-container">');"static"===i.$el.css("position")&&i.$el.css("position","relative"),i.$el.css("z-index","1"),$(i.$el).prepend(o),i.$el.is("body")&&o.css({position:"fixed"})},i.overlay=function(){var o=i.$container,e=i.$overlay=$('<div class="vidbg-overlay">');!0===i.options.overlay&&e.css({background:"rgba("+t(i.options.overlayColor).r+", "+t(i.options.overlayColor).g+", "+t(i.options.overlayColor).b+", "+i.options.overlayAlpha+")"}),o.append(e)},i.tapToUnmute=function(){if(!1!==i.options.tapToUnmute){var o=i.$tapToUnmuteButton=$('<div class="vidbg-tap-to-unmute">'+i.options.tapToUnmuteText+"</div>");o.on("click",function(o){o.preventDefault(),i.$selfHostVideo.prop("muted",!1),this.remove()}),i.$el.append(o)}},i.displayPoster=function(o){var e=i.$container;"#"!==i.options.poster&&(!0===o&&e.css("background-image","url("+i.options.poster+")"),!0===i.isMobile()?e.css("background-image","url("+i.options.poster+")"):"#"===i.options.mp4&&"#"===i.options.webm&&e.css("background-image","url("+i.options.poster+")"))},i.selfHostVideo=function(){if(!0!==i.isMobile()&&("#"!==i.options.mp4||"#"!==i.options.webm)){var o=i.$container,e=i.$selfHostVideo=$('<video playsinline><source src="'+i.options.mp4+'" type="video/mp4"><source src="'+i.options.webm+'" type="video/webm"></video>');try{e.prop({autoplay:!0,loop:i.options.repeat,volume:1,muted:i.options.mute,defaultMuted:i.options.mute,playbackRate:1,defaultPlaybackRate:1})}catch(o){console.log("error")}var t=e.get(0).play();void 0!==t&&t.then(function(){}).catch(function(o){i.displayPoster(!0)}),e.one("canplaythrough.vidbg",function(){i.resize()}),e.one("playing.vidbg",function(){e.css({opacity:1})}),o.append(e)}},i.resize=function(){if(!0!==i.isMobile()&&("#"!==i.options.mp4||"#"!==i.options.webm)){var o=i.$container,e=o.outerHeight(),t=o.outerWidth(),n;n=i.$selfHostVideo;var a,s;a=n[0].videoHeight,s=n[0].videoWidth,t/s>e/a?n.css({width:t+2,height:"auto"}):n.css({width:"auto",height:e+2})}},i.init()},$.vidbg.defaultOptions={mp4:"#",webm:"#",poster:"#",mute:!0,tapToUnmute:!1,tapToUnmuteText:"Tap to unmute",repeat:!0,overlay:!1,overlayColor:"#000",overlayAlpha:"0.3"},$.fn.vidbg=function(o){return this.each(function(){var e=new $.vidbg(this,o);$(this).data("vidbg",e),$(window).resize(function(){e.resize()})})}}(jQuery);
3
  * Copyright 2017 Push Labs
4
  * @preserve
5
  */
6
+ !function($){$.vidbg=function(o,e){function t(o){var e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;o=o.replace(e,function(o,e,t,i){return e+e+t+t+i+i});var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(o);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null}var i=this;i.$el=$(o),i.el=o,i.$el.data("vidbg",i),i.init=function(){i.options=$.extend({},$.vidbg.defaultOptions,e),i.container(),i.displayPoster(),i.selfHostVideo(),i.tapToUnmute(),i.overlay()},i.isMobile=function(){return!!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)},i.container=function(){var o=i.$container=$('<div class="vidbg-container">');"static"===i.$el.css("position")&&i.$el.css("position","relative"),i.$el.css("z-index","1"),$(i.$el).prepend(o),i.$el.is("body")&&o.css({position:"fixed"})},i.overlay=function(){var o=i.$container,e=i.$overlay=$('<div class="vidbg-overlay">');!0===i.options.overlay&&e.css({background:"rgba("+t(i.options.overlayColor).r+", "+t(i.options.overlayColor).g+", "+t(i.options.overlayColor).b+", "+i.options.overlayAlpha+")"}),o.append(e)},i.tapToUnmute=function(){if(!0!==i.isMobile()&&!1!==i.options.tapToUnmute){var o=i.$tapToUnmuteButton=$('<div class="vidbg-tap-to-unmute">'+i.options.tapToUnmuteText+"</div>");o.on("click",function(o){o.preventDefault(),i.$selfHostVideo.prop("muted",!1),this.remove()}),i.$el.append(o)}},i.displayPoster=function(o){var e=i.$container;"#"!==i.options.poster&&(!0===o&&e.css("background-image","url("+i.options.poster+")"),!0===i.isMobile()?e.css("background-image","url("+i.options.poster+")"):"#"===i.options.mp4&&"#"===i.options.webm&&e.css("background-image","url("+i.options.poster+")"))},i.selfHostVideo=function(){if(!0!==i.isMobile()&&("#"!==i.options.mp4||"#"!==i.options.webm)){var o=i.$container,e=i.$selfHostVideo=$('<video playsinline><source src="'+i.options.mp4+'" type="video/mp4"><source src="'+i.options.webm+'" type="video/webm"></video>');try{e.prop({autoplay:!0,loop:i.options.repeat,volume:1,muted:i.options.mute,defaultMuted:i.options.mute,playbackRate:1,defaultPlaybackRate:1})}catch(o){console.log("error")}var t=e.get(0).play();void 0!==t&&t.then(function(){}).catch(function(o){i.displayPoster(!0)}),e.one("canplaythrough.vidbg",function(){i.resize()}),e.one("playing.vidbg",function(){e.css({opacity:1})}),o.append(e)}},i.resize=function(){if(!0!==i.isMobile()&&("#"!==i.options.mp4||"#"!==i.options.webm)){var o=i.$container,e=o.outerHeight(),t=o.outerWidth(),n;n=i.$selfHostVideo;var a,s;a=n[0].videoHeight,s=n[0].videoWidth,t/s>e/a?n.css({width:t+2,height:"auto"}):n.css({width:"auto",height:e+2})}},i.init()},$.vidbg.defaultOptions={mp4:"#",webm:"#",poster:"#",mute:!0,tapToUnmute:!1,tapToUnmuteText:"Tap to unmute",repeat:!0,overlay:!1,overlayColor:"#000",overlayAlpha:"0.3"},$.fn.vidbg=function(o){return this.each(function(){var e=new $.vidbg(this,o);$(this).data("vidbg",e),$(window).resize(function(){e.resize()})})}}(jQuery);
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: blakedotvegas, pushlabs
3
  Tags: video background, Visual Composer, WPBakery, SiteOrigin, page builder
4
  Requires at least: 4.5
5
- Tested up to: 4.9.5
6
- Stable tag: 2.7.0
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -84,6 +84,9 @@ To add a video background to a class called **header** add ".header" to the cont
84
 
85
  == Changelog ==
86
 
 
 
 
87
  = 2.7.0 =
88
  * Added: You can now add a video background to your WPBakery (Visual Composer) row!
89
  * Added: You can now add a video background to your SiteOrigin Page Builder row!
2
  Contributors: blakedotvegas, pushlabs
3
  Tags: video background, Visual Composer, WPBakery, SiteOrigin, page builder
4
  Requires at least: 4.5
5
+ Tested up to: 5.0.3
6
+ Stable tag: 2.7.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
84
 
85
  == Changelog ==
86
 
87
+ = 2.7.1 =
88
+ * Fixed: Remove tap to unmute button when video background can't be played
89
+
90
  = 2.7.0 =
91
  * Added: You can now add a video background to your WPBakery (Visual Composer) row!
92
  * Added: You can now add a video background to your SiteOrigin Page Builder row!