Skip to content

Commit

Permalink
Release v0.3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
vodkabears committed Apr 19, 2015
1 parent 1b594cc commit 27b3b8d
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 68 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vide",
"version": "0.3.2",
"version": "0.3.3",
"homepage": "http://vodkabears.github.io/vide/",
"authors": [
"Ilya Makarov <[email protected]>"
Expand Down
126 changes: 63 additions & 63 deletions dist/jquery.vide.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,34 @@
/*
* Vide - v0.3.2
* Vide - v0.3.3
* Easy as hell jQuery plugin for video backgrounds.
* http://vodkabears.github.io/vide/
*
* Made by Ilya Makarov
* Under MIT License
*/
!(function($, window, document, navigator) {
!(function(root, factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery'], factory);
} else if (typeof exports === 'object') {
factory(require('jquery'));
} else {
factory(root.jQuery);
}
})(this, function($) {

'use strict';

/**
* Name of the plugin
* @private
* @type {String}
*/
var pluginName = 'vide';

/**
* Default settings
* @private
* @type {Object}
*/
var defaults = {
volume: 1,
Expand All @@ -30,18 +41,6 @@
resizing: true
};

/**
* Is iOs?
* @private
*/
var isIOS = /iPad|iPhone|iPod/i.test(navigator.userAgent);

/**
* Is Android?
* @private
*/
var isAndroid = /Android/i.test(navigator.userAgent);

/**
* Parse a string with options
* @private
Expand Down Expand Up @@ -213,7 +212,7 @@
Vide.prototype.init = function() {
var vide = this;
var position = parsePosition(vide.settings.position);
var sources;
var sources = '';
var poster;

// Set styles of a video wrapper
Expand Down Expand Up @@ -266,50 +265,43 @@

vide.$element.prepend(vide.$wrapper);

if (!isIOS && !isAndroid) {
sources = '';

if (typeof vide.path === 'object') {
if (vide.path.mp4) {
sources += '<source src="' + vide.path.mp4 + '.mp4" type="video/mp4">';
}

if (vide.path.webm) {
sources += '<source src="' + vide.path.webm + '.webm" type="video/webm">';
}
if (typeof vide.path === 'object') {
if (vide.path.mp4) {
sources += '<source src="' + vide.path.mp4 + '.mp4" type="video/mp4">';
}

if (vide.path.ogv) {
sources += '<source src="' + vide.path.ogv + '.ogv" type="video/ogv">';
}
if (vide.path.webm) {
sources += '<source src="' + vide.path.webm + '.webm" type="video/webm">';
}

vide.$video = $('<video>' + sources + '</video>');
} else {
vide.$video = $('<video>' +
'<source src="' + vide.path + '.mp4" type="video/mp4">' +
'<source src="' + vide.path + '.webm" type="video/webm">' +
'<source src="' + vide.path + '.ogv" type="video/ogg">' +
'</video>');
if (vide.path.ogv) {
sources += '<source src="' + vide.path.ogv + '.ogv" type="video/ogv">';
}

// Disable visibility, while loading
vide.$video.css('visibility', 'hidden');
vide.$video = $('<video>' + sources + '</video>');
} else {
vide.$video = $('<video>' +
'<source src="' + vide.path + '.mp4" type="video/mp4">' +
'<source src="' + vide.path + '.webm" type="video/webm">' +
'<source src="' + vide.path + '.ogv" type="video/ogg">' +
'</video>');
}

vide.$video

// Set video properties
vide.$video.prop({
.prop({
autoplay: vide.settings.autoplay,
loop: vide.settings.loop,
volume: vide.settings.volume,
muted: vide.settings.muted,
defaultMuted: vide.settings.muted,
playbackRate: vide.settings.playbackRate,
defaultPlaybackRate: vide.settings.playbackRate
});

// Append a video
vide.$wrapper.append(vide.$video);
})

// Video alignment
vide.$video.css({
.css({
margin: 'auto',
position: 'absolute',
'z-index': -1,
Expand All @@ -318,37 +310,38 @@
'-webkit-transform': 'translate(-' + position.x + ', -' + position.y + ')',
'-ms-transform': 'translate(-' + position.x + ', -' + position.y + ')',
'-moz-transform': 'translate(-' + position.x + ', -' + position.y + ')',
transform: 'translate(-' + position.x + ', -' + position.y + ')'
});
transform: 'translate(-' + position.x + ', -' + position.y + ')',

// Disable visibility, while loading
visibility: 'hidden'
})

// Resize a video, when it's loaded
vide.$video.on('canplaythrough.' + pluginName, function() {
.on('canplaythrough.' + pluginName, function() {
vide.$video.css('visibility', 'visible');

// Force to play, important for Safari
vide.$video.prop('autoplay') && vide.$video[0].play();

vide.resize();
vide.$wrapper.css('background-image', 'none');
});

// Resize event is available only for 'window'
// Use another code solutions to detect DOM elements resizing
vide.$element.on('resize.' + pluginName, function() {
if (vide.settings.resizing) {
vide.resize();
}
});
}
// Resize event is available only for 'window'
// Use another code solutions to detect DOM elements resizing
vide.$element.on('resize.' + pluginName, function() {
if (vide.settings.resizing) {
vide.resize();
}
});

// Append a video
vide.$wrapper.append(vide.$video);
};

/**
* Get a video element
* @public
* @returns {HTMLVideoElement|null}
* @returns {HTMLVideoElement}
*/
Vide.prototype.getVideoObject = function() {
return this.$video ? this.$video[0] : null;
return this.$video[0];
};

/**
Expand Down Expand Up @@ -439,9 +432,10 @@
};

$(document).ready(function() {
var $window = $(window);

// Window resize event listener
$(window).on('resize.' + pluginName, function() {
$window.on('resize.' + pluginName, function() {
for (var len = $[pluginName].lookup.length, i = 0, instance; i < len; i++) {
instance = $[pluginName].lookup[i];

Expand All @@ -451,6 +445,11 @@
}
});

// https://github.com/VodkaBears/Vide/issues/68
$window.on('unload.' + pluginName, function() {
return false;
});

// Auto initialization
// Add 'data-vide-bg' attribute with a path to the video without extension
// Also you can pass options throw the 'data-vide-options' attribute
Expand All @@ -463,4 +462,5 @@
$element[pluginName](path, options);
});
});
})(window.jQuery, window, document, navigator);

});
4 changes: 2 additions & 2 deletions dist/jquery.vide.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Package.describe({
git: 'https://github.com/VodkaBears/Vide.git',
name: 'vodkabears:vide',
summary: 'Easy as hell jQuery plugin for video backgrounds',
version: '0.3.2'
version: '0.3.3'
});

Package.onUse(function(api) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vide",
"version": "0.3.2",
"version": "0.3.3",
"description": "Easy as hell jQuery plugin for video backgrounds.",
"keywords": [
"jquery-plugin",
Expand Down

0 comments on commit 27b3b8d

Please sign in to comment.