Created
February 3, 2013 17:28
-
-
Save clubajax/4702704 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fixParams = function(o){ | |
var _vid = o.videoId || o.vid || o.siteId || ""; | |
if(/\,/.test(_vid)){ | |
o.media = []; | |
o.mediaParam = 'vid=' + _vid; | |
_vid.split(',').forEach(function(id){ | |
o.media.push({videoId:id}); | |
}); | |
if(o.titles){ | |
o.mediaParam += '&titles=' + o.titles; | |
o.titles.split(',').forEach(function(title, i){ | |
o.media[i].caption = unescape(title); | |
}); | |
delete o.titles; | |
} | |
delete o.videoId; | |
delete o.vid; | |
delete o.siteId; | |
}else if(o.media){ | |
o.mediaParam = 'media=' + o.media; | |
} | |
var vid = o.videoId || o.vid || o.siteId || ""; | |
var lid = o.locationId || o.lid; | |
var cid = Number(o.clientId) || o.cid; | |
if(lid === 1 || lid === "1" || !lid) lid = 0; | |
for(var nm in this.params){ | |
if(o[nm] === undefined) o[nm] = this.params[nm]; | |
} | |
if(!o.videoId && !o.siteId && !o.vid && o.media){ | |
if(/siteId/.test(o.media)){ | |
var pms = this.strToObj(unescape(o.media)); | |
this.settings.siteId = pms.siteId; | |
} | |
} | |
if(o.path){ o.file = o.path; } | |
if(o.automuterestart){ | |
o.autoplay = true; | |
o.automute = true; | |
} | |
if(o.automute) o.autoplay = true; | |
var html5Video = true; | |
if(o.file){ | |
var ext = this.last(o.file, '.'); | |
if(ext.toLowerCase() == 'flv') html5Video = false; | |
} | |
this.settings.init({ | |
vid:vid, | |
lid:lid, | |
cid:cid, | |
bid:o.lowBandId, | |
file:o.file, | |
poster:o.poster, | |
media:o.media, | |
theme:o.theme, | |
autoplay:o.autoplay || false, | |
automute:o.automute, | |
automuterestart:o.automuterestart, | |
clickurl:o.clickurl, | |
html5Video:html5Video | |
}); | |
if(!o.media && !o.path){ | |
o.src = o.path = this.settings.getVideoPath(); | |
o.mobile = this.settings.getVideoPath('mobile'); | |
o.preview = this.settings.getPreviewPath(); | |
} | |
o.node = this.byId(o.nodeId) || o.node || (this.mdsEmbed() || scriptNode).parentNode; | |
if(!o.w && ! o.width){ | |
var box = this.size(o.node) | |
if(!box.w || !box.h){ | |
console.warn("No sizes for node.") | |
}else{ | |
o.width = box.w; o.height = box.h; | |
} | |
} | |
o.w = o.width; o.h = o.height; | |
o.autoplay = this.settings.autoplay; | |
o.automute = this.settings.automute; | |
o.automuterestart = this.settings.automuterestart; | |
if(this.config.swf) o.swf = this.config.swf; | |
this.params = o; | |
bv.settings.setSocialOptions(o); | |
if(!o.media){ | |
var first = bv.playlist.set(o); | |
o.path = o.file = first.path; | |
if ( !o.src && first.path ) { | |
o.src = first.path; | |
} | |
o.preview = first.preview; | |
} | |
return o; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment