Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Allow the videoSource array to contain strings again #16

Merged
merged 1 commit into from

2 participants

@papandreou

As of 613967a elements in the videoSource array have to be arrays with one or two items, leading to awkward syntax when no type is provided:

    videoSource: [
        ['http://....'],
        ['http://....']
    ]

instead of this:

    videoSource: [
        'http://....',
        'http://....'
    ]

Since you're still using the old syntax on http://www.georgepaterson.com/sandbox/jquery-html5-video-background-demo/ I'm assuming that's a bug, and I've attached a fix that allows both syntaxes.

@georgepaterson georgepaterson merged commit c26f70b into from
@georgepaterson

Good spot papandreou.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 13, 2012
  1. @papandreou
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 2 deletions.
  1. +3 −2 script/jquery.videobackground.js
View
5 script/jquery.videobackground.js
@@ -179,10 +179,11 @@
*
*/
$.each(that.settings.videoSource, function () {
- if (this[1] !== undefined) {
+ var isArray = Object.prototype.toString.call(this) === '[object Array]';
+ if (isArray && this[1] !== undefined) {
compiledSource = compiledSource + '<source src="' + this[0] + '" type="' + this[1] + '">';
} else {
- compiledSource = compiledSource + '<source src="' + this[0] + '">';
+ compiledSource = compiledSource + '<source src="' + (isArray ? this[0] : this) + '">';
}
});
attributes = attributes + 'preload="' + that.settings.preload + '"';
Something went wrong with that request. Please try again.