Skip to content

Instantly share code, notes, and snippets.

@DamonOehlman
Created June 4, 2014 10:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DamonOehlman/f9b5787c7328b23fc14d to your computer and use it in GitHub Desktop.
Save DamonOehlman/f9b5787c7328b23fc14d to your computer and use it in GitHub Desktop.
requirebin sketch
// require the media capture helper from rtc.io
var media = require('rtc-media');
// capture the local media, letting rtc-media know it can use
// the temasys plugin
var localMedia = media({
plugins: [
require('rtc-plugin-temasys')
]
});
// render the media to the document body
localMedia.render(document.body);
require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({ZNFGjp:[function(require,module,exports){"use strict";var crel=require("crel");var PLUGIN_MIMETYPE="application/x-temwebrtcplugin";var pageId=genId();function genId(){return Math.random().toString(36).slice(2)}exports.supported=function(platform){return["ie","safari"].indexOf(platform.browser.toLowerCase())>=0};var init=exports.init=function(opts,callback){var plugin=document.querySelector('object[type="'+PLUGIN_MIMETYPE+'"]');var pluginId="__temasys_plugin_"+genId();var params=[{name:"onload",value:"__load"+pluginId},{name:"pluginId",value:pluginId}];function getUserMedia(constraints,successCb,failureCb){plugin.getUserMedia.call(plugin,constraints,function(stream){console.log("captured stream: ",stream);if(typeof successCb=="function"){successCb(stream)}},function(err){console.log("failed capturing stream: ",err);if(typeof failureCb=="function"){failureCb(err)}})}window["__load"+pluginId]=function(){window["__load"+pluginId]=undefined;console.log("plugin loaded");plugin.setPluginId(pageId,pluginId);plugin.setLogFunction(console);navigator.getUserMedia=getUserMedia;if(typeof callback=="function"){callback(null,plugin)}};if(!plugin){plugin=crel("object",{width:0,height:0,type:PLUGIN_MIMETYPE,id:pluginId});params.forEach(function(data){plugin.appendChild(crel("param",data))});document.body.appendChild(plugin)}return plugin};exports.initMedia=function(media,callback){callback=callback||function(){};init(function(err){if(err){return callback(err)}callback()})};exports.attachStream=function(stream,bindings){var createRenderSurfaces=bindings.map(function(binding){return typeof binding.el=="function"&&binding.el}).filter(Boolean);stream.enableSoundTracks(true);createRenderSurfaces.forEach(function(fn){fn(stream)})};exports.prepareElement=function(opts,element){var shouldReplace=element instanceof HTMLVideoElement||element instanceof HTMLAudioElement;var container=shouldReplace?element.parentNode:element;var rendererId=genId();var params=[{name:"pluginId",value:rendererId},{name:"pageId",value:pageId}];function createRenderSurface(stream){var renderParams=params.concat([{name:"streamId",value:stream.id}]);var renderer=crel("object",{id:rendererId,type:PLUGIN_MIMETYPE});renderParams.forEach(function(data){renderer.appendChild(crel("param",data))});renderer.width=640;renderer.height=320;if(shouldReplace){container.insertBefore(renderer);container.removeChild(element)}else{container.appendChild(renderer)}}return createRenderSurface}},{crel:3}],"rtc-plugin-temasys":[function(require,module,exports){module.exports=require("ZNFGjp")},{}],3:[function(require,module,exports){(function(root,factory){if(typeof exports==="object"){module.exports=factory()}else if(typeof define==="function"&&define.amd){define(factory)}else{root.crel=factory()}})(this,function(){var isNode=typeof Node==="function"?function(object){return object instanceof Node}:function(object){return object&&typeof object==="object"&&typeof object.nodeType==="number"&&typeof object.nodeName==="string"};var isArray=function(a){return a instanceof Array};var appendChild=function(element,child){if(!isNode(child)){child=document.createTextNode(child)}element.appendChild(child)};function crel(){var document=window.document,args=arguments,element=args[0],child,settings=args[1],childIndex=2,argumentsLength=args.length,attributeMap=crel.attrMap;element=isNode(element)?element:document.createElement(element);if(argumentsLength===1){return element}if(typeof settings!=="object"||isNode(settings)||isArray(settings)){--childIndex;settings=null}if(argumentsLength-childIndex===1&&typeof args[childIndex]==="string"&&element.textContent!==undefined){element.textContent=args[childIndex]}else{for(;childIndex<argumentsLength;++childIndex){child=args[childIndex];if(child==null){continue}if(isArray(child)){for(var i=0;i<child.length;++i){appendChild(element,child[i])}}else{appendChild(element,child)}}}for(var key in settings){if(!attributeMap[key]){element.setAttribute(key,settings[key])}else{var attr=crel.attrMap[key];if(typeof attr==="function"){attr(element,settings[key])}else{element.setAttribute(attr,settings[key])}}}return element}crel["attrMap"]={};crel["isNode"]=isNode;return crel})},{}]},{},[]);require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){function EventEmitter(){this._events=this._events||{};this._maxListeners=this._maxListeners||undefined}module.exports=EventEmitter;EventEmitter.EventEmitter=EventEmitter;EventEmitter.prototype._events=undefined;EventEmitter.prototype._maxListeners=undefined;EventEmitter.defaultMaxListeners=10;EventEmitter.prototype.setMaxListeners=function(n){if(!isNumber(n)||n<0||isNaN(n))throw TypeError("n must be a positive number");this._maxListeners=n;return this};EventEmitter.prototype.emit=function(type){var er,handler,len,args,i,listeners;if(!this._events)this._events={};if(type==="error"){if(!this._events.error||isObject(this._events.error)&&!this._events.error.length){er=arguments[1];if(er instanceof Error){throw er}else{throw TypeError('Uncaught, unspecified "error" event.')}return false}}handler=this._events[type];if(isUndefined(handler))return false;if(isFunction(handler)){switch(arguments.length){case 1:handler.call(this);break;case 2:handler.call(this,arguments[1]);break;case 3:handler.call(this,arguments[1],arguments[2]);break;default:len=arguments.length;args=new Array(len-1);for(i=1;i<len;i++)args[i-1]=arguments[i];handler.apply(this,args)}}else if(isObject(handler)){len=arguments.length;args=new Array(len-1);for(i=1;i<len;i++)args[i-1]=arguments[i];listeners=handler.slice();len=listeners.length;for(i=0;i<len;i++)listeners[i].apply(this,args)}return true};EventEmitter.prototype.addListener=function(type,listener){var m;if(!isFunction(listener))throw TypeError("listener must be a function");if(!this._events)this._events={};if(this._events.newListener)this.emit("newListener",type,isFunction(listener.listener)?listener.listener:listener);if(!this._events[type])this._events[type]=listener;else if(isObject(this._events[type]))this._events[type].push(listener);else this._events[type]=[this._events[type],listener];if(isObject(this._events[type])&&!this._events[type].warned){var m;if(!isUndefined(this._maxListeners)){m=this._maxListeners}else{m=EventEmitter.defaultMaxListeners}if(m&&m>0&&this._events[type].length>m){this._events[type].warned=true;console.error("(node) warning: possible EventEmitter memory "+"leak detected. %d listeners added. "+"Use emitter.setMaxListeners() to increase limit.",this._events[type].length);console.trace()}}return this};EventEmitter.prototype.on=EventEmitter.prototype.addListener;EventEmitter.prototype.once=function(type,listener){if(!isFunction(listener))throw TypeError("listener must be a function");var fired=false;function g(){this.removeListener(type,g);if(!fired){fired=true;listener.apply(this,arguments)}}g.listener=listener;this.on(type,g);return this};EventEmitter.prototype.removeListener=function(type,listener){var list,position,length,i;if(!isFunction(listener))throw TypeError("listener must be a function");if(!this._events||!this._events[type])return this;list=this._events[type];length=list.length;position=-1;if(list===listener||isFunction(list.listener)&&list.listener===listener){delete this._events[type];if(this._events.removeListener)this.emit("removeListener",type,listener)}else if(isObject(list)){for(i=length;i-->0;){if(list[i]===listener||list[i].listener&&list[i].listener===listener){position=i;break}}if(position<0)return this;if(list.length===1){list.length=0;delete this._events[type]}else{list.splice(position,1)}if(this._events.removeListener)this.emit("removeListener",type,listener)}return this};EventEmitter.prototype.removeAllListeners=function(type){var key,listeners;if(!this._events)return this;if(!this._events.removeListener){if(arguments.length===0)this._events={};else if(this._events[type])delete this._events[type];return this}if(arguments.length===0){for(key in this._events){if(key==="removeListener")continue;this.removeAllListeners(key)}this.removeAllListeners("removeListener");this._events={};return this}listeners=this._events[type];if(isFunction(listeners)){this.removeListener(type,listeners)}else{while(listeners.length)this.removeListener(type,listeners[listeners.length-1])}delete this._events[type];return this};EventEmitter.prototype.listeners=function(type){var ret;if(!this._events||!this._events[type])ret=[];else if(isFunction(this._events[type]))ret=[this._events[type]];else ret=this._events[type].slice();return ret};EventEmitter.listenerCount=function(emitter,type){var ret;if(!emitter._events||!emitter._events[type])ret=0;else if(isFunction(emitter._events[type]))ret=1;else ret=emitter._events[type].length;return ret};function isFunction(arg){return typeof arg==="function"}function isNumber(arg){return typeof arg==="number"}function isObject(arg){return typeof arg==="object"&&arg!==null}function isUndefined(arg){return arg===void 0}},{}],2:[function(require,module,exports){if(typeof Object.create==="function"){module.exports=function inherits(ctor,superCtor){ctor.super_=superCtor;ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:false,writable:true,configurable:true}})}}else{module.exports=function inherits(ctor,superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype;ctor.prototype=new TempCtor;ctor.prototype.constructor=ctor}}},{}],3:[function(require,module,exports){var process=module.exports={};process.nextTick=function(){var canSetImmediate=typeof window!=="undefined"&&window.setImmediate;var canPost=typeof window!=="undefined"&&window.postMessage&&window.addEventListener;if(canSetImmediate){return function(f){return window.setImmediate(f)}}if(canPost){var queue=[];window.addEventListener("message",function(ev){var source=ev.source;if((source===window||source===null)&&ev.data==="process-tick"){ev.stopPropagation();if(queue.length>0){var fn=queue.shift();fn()}}},true);return function nextTick(fn){queue.push(fn);window.postMessage("process-tick","*")}}return function nextTick(fn){setTimeout(fn,0)}}();process.title="browser";process.browser=true;process.env={};process.argv=[];function noop(){}process.on=noop;process.once=noop;process.off=noop;process.emit=noop;process.binding=function(name){throw new Error("process.binding is not supported")};process.cwd=function(){return"/"};process.chdir=function(dir){throw new Error("process.chdir is not supported")}},{}],4:[function(require,module,exports){module.exports=function isBuffer(arg){return arg&&typeof arg==="object"&&typeof arg.copy==="function"&&typeof arg.fill==="function"&&typeof arg.readUInt8==="function"}},{}],5:[function(require,module,exports){(function(process,global){var formatRegExp=/%[sdj%]/g;exports.format=function(f){if(!isString(f)){var objects=[];for(var i=0;i<arguments.length;i++){objects.push(inspect(arguments[i]))}return objects.join(" ")}var i=1;var args=arguments;var len=args.length;var str=String(f).replace(formatRegExp,function(x){if(x==="%%")return"%";if(i>=len)return x;switch(x){case"%s":return String(args[i++]);case"%d":return Number(args[i++]);case"%j":try{return JSON.stringify(args[i++])}catch(_){return"[Circular]"}default:return x}});for(var x=args[i];i<len;x=args[++i]){if(isNull(x)||!isObject(x)){str+=" "+x}else{str+=" "+inspect(x)}}return str};exports.deprecate=function(fn,msg){if(isUndefined(global.process)){return function(){return exports.deprecate(fn,msg).apply(this,arguments)}}if(process.noDeprecation===true){return fn}var warned=false;function deprecated(){if(!warned){if(process.throwDeprecation){throw new Error(msg)}else if(process.traceDeprecation){console.trace(msg)}else{console.error(msg)}warned=true}return fn.apply(this,arguments)}return deprecated};var debugs={};var debugEnviron;exports.debuglog=function(set){if(isUndefined(debugEnviron))debugEnviron=process.env.NODE_DEBUG||"";set=set.toUpperCase();if(!debugs[set]){if(new RegExp("\\b"+set+"\\b","i").test(debugEnviron)){var pid=process.pid;debugs[set]=function(){var msg=exports.format.apply(exports,arguments);console.error("%s %d: %s",set,pid,msg)}}else{debugs[set]=function(){}}}return debugs[set]};function inspect(obj,opts){var ctx={seen:[],stylize:stylizeNoColor};if(arguments.length>=3)ctx.depth=arguments[2];if(arguments.length>=4)ctx.colors=arguments[3];if(isBoolean(opts)){ctx.showHidden=opts}else if(opts){exports._extend(ctx,opts)}if(isUndefined(ctx.showHidden))ctx.showHidden=false;if(isUndefined(ctx.depth))ctx.depth=2;if(isUndefined(ctx.colors))ctx.colors=false;if(isUndefined(ctx.customInspect))ctx.customInspect=true;if(ctx.colors)ctx.stylize=stylizeWithColor;return formatValue(ctx,obj,ctx.depth)}exports.inspect=inspect;inspect.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]};inspect.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"};function stylizeWithColor(str,styleType){var style=inspect.styles[styleType];if(style){return"["+inspect.colors[style][0]+"m"+str+"["+inspect.colors[style][1]+"m"}else{return str}}function stylizeNoColor(str,styleType){return str}function arrayToHash(array){var hash={};array.forEach(function(val,idx){hash[val]=true});return hash}function formatValue(ctx,value,recurseTimes){if(ctx.customInspect&&value&&isFunction(value.inspect)&&value.inspect!==exports.inspect&&!(value.constructor&&value.constructor.prototype===value)){var ret=value.inspect(recurseTimes,ctx);if(!isString(ret)){ret=formatValue(ctx,ret,recurseTimes)}return ret}var primitive=formatPrimitive(ctx,value);if(primitive){return primitive}var keys=Object.keys(value);var visibleKeys=arrayToHash(keys);if(ctx.showHidden){keys=Object.getOwnPropertyNames(value)}if(isError(value)&&(keys.indexOf("message")>=0||keys.indexOf("description")>=0)){return formatError(value)}if(keys.length===0){if(isFunction(value)){var name=value.name?": "+value.name:"";return ctx.stylize("[Function"+name+"]","special")}if(isRegExp(value)){return ctx.stylize(RegExp.prototype.toString.call(value),"regexp")}if(isDate(value)){return ctx.stylize(Date.prototype.toString.call(value),"date")}if(isError(value)){return formatError(value)}}var base="",array=false,braces=["{","}"];if(isArray(value)){array=true;braces=["[","]"]}if(isFunction(value)){var n=value.name?": "+value.name:"";base=" [Function"+n+"]"}if(isRegExp(value)){base=" "+RegExp.prototype.toString.call(value)}if(isDate(value)){base=" "+Date.prototype.toUTCString.call(value)}if(isError(value)){base=" "+formatError(value)}if(keys.length===0&&(!array||value.length==0)){return braces[0]+base+braces[1]}if(recurseTimes<0){if(isRegExp(value)){return ctx.stylize(RegExp.prototype.toString.call(value),"regexp")}else{return ctx.stylize("[Object]","special")}}ctx.seen.push(value);var output;if(array){output=formatArray(ctx,value,recurseTimes,visibleKeys,keys)}else{output=keys.map(function(key){return formatProperty(ctx,value,recurseTimes,visibleKeys,key,array)})}ctx.seen.pop();return reduceToSingleString(output,base,braces)}function formatPrimitive(ctx,value){if(isUndefined(value))return ctx.stylize("undefined","undefined");if(isString(value)){var simple="'"+JSON.stringify(value).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return ctx.stylize(simple,"string")}if(isNumber(value))return ctx.stylize(""+value,"number");if(isBoolean(value))return ctx.stylize(""+value,"boolean");if(isNull(value))return ctx.stylize("null","null")}function formatError(value){return"["+Error.prototype.toString.call(value)+"]"}function formatArray(ctx,value,recurseTimes,visibleKeys,keys){var output=[];for(var i=0,l=value.length;i<l;++i){if(hasOwnProperty(value,String(i))){output.push(formatProperty(ctx,value,recurseTimes,visibleKeys,String(i),true))}else{output.push("")}}keys.forEach(function(key){if(!key.match(/^\d+$/)){output.push(formatProperty(ctx,value,recurseTimes,visibleKeys,key,true))}});return output}function formatProperty(ctx,value,recurseTimes,visibleKeys,key,array){var name,str,desc;desc=Object.getOwnPropertyDescriptor(value,key)||{value:value[key]};if(desc.get){if(desc.set){str=ctx.stylize("[Getter/Setter]","special")}else{str=ctx.stylize("[Getter]","special")}}else{if(desc.set){str=ctx.stylize("[Setter]","special")}}if(!hasOwnProperty(visibleKeys,key)){name="["+key+"]"}if(!str){if(ctx.seen.indexOf(desc.value)<0){if(isNull(recurseTimes)){str=formatValue(ctx,desc.value,null)}else{str=formatValue(ctx,desc.value,recurseTimes-1)}if(str.indexOf("\n")>-1){if(array){str=str.split("\n").map(function(line){return" "+line}).join("\n").substr(2)}else{str="\n"+str.split("\n").map(function(line){return" "+line}).join("\n")}}}else{str=ctx.stylize("[Circular]","special")}}if(isUndefined(name)){if(array&&key.match(/^\d+$/)){return str}name=JSON.stringify(""+key);if(name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)){name=name.substr(1,name.length-2);name=ctx.stylize(name,"name")}else{name=name.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'");name=ctx.stylize(name,"string")}}return name+": "+str}function reduceToSingleString(output,base,braces){var numLinesEst=0;var length=output.reduce(function(prev,cur){numLinesEst++;if(cur.indexOf("\n")>=0)numLinesEst++;return prev+cur.replace(/\u001b\[\d\d?m/g,"").length+1},0);if(length>60){return braces[0]+(base===""?"":base+"\n ")+" "+output.join(",\n ")+" "+braces[1]}return braces[0]+base+" "+output.join(", ")+" "+braces[1]}function isArray(ar){return Array.isArray(ar)}exports.isArray=isArray;function isBoolean(arg){return typeof arg==="boolean"}exports.isBoolean=isBoolean;function isNull(arg){return arg===null}exports.isNull=isNull;function isNullOrUndefined(arg){return arg==null}exports.isNullOrUndefined=isNullOrUndefined;function isNumber(arg){return typeof arg==="number"}exports.isNumber=isNumber;function isString(arg){return typeof arg==="string"}exports.isString=isString;function isSymbol(arg){return typeof arg==="symbol"}exports.isSymbol=isSymbol;function isUndefined(arg){return arg===void 0}exports.isUndefined=isUndefined;function isRegExp(re){return isObject(re)&&objectToString(re)==="[object RegExp]"}exports.isRegExp=isRegExp;function isObject(arg){return typeof arg==="object"&&arg!==null}exports.isObject=isObject;function isDate(d){return isObject(d)&&objectToString(d)==="[object Date]"}exports.isDate=isDate;function isError(e){return isObject(e)&&(objectToString(e)==="[object Error]"||e instanceof Error)}exports.isError=isError;function isFunction(arg){return typeof arg==="function"}exports.isFunction=isFunction;function isPrimitive(arg){return arg===null||typeof arg==="boolean"||typeof arg==="number"||typeof arg==="string"||typeof arg==="symbol"||typeof arg==="undefined"}exports.isPrimitive=isPrimitive;exports.isBuffer=require("./support/isBuffer");function objectToString(o){return Object.prototype.toString.call(o)}function pad(n){return n<10?"0"+n.toString(10):n.toString(10)}var months=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function timestamp(){var d=new Date;var time=[pad(d.getHours()),pad(d.getMinutes()),pad(d.getSeconds())].join(":");return[d.getDate(),months[d.getMonth()],time].join(" ")}exports.log=function(){console.log("%s - %s",timestamp(),exports.format.apply(exports,arguments))};exports.inherits=require("inherits");exports._extend=function(origin,add){if(!add||!isObject(add))return origin;var keys=Object.keys(add);var i=keys.length;while(i--){origin[keys[i]]=add[keys[i]]}return origin};function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}}).call(this,require("/home/admin/browserify-cdn/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./support/isBuffer":4,"/home/admin/browserify-cdn/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":3,inherits:2}],"rtc-media":[function(require,module,exports){module.exports=require("Xypawh")},{}],Xypawh:[function(require,module,exports){"use strict";var debug=require("cog/logger")("rtc-media");var extend=require("cog/extend");var detect=require("rtc-core/detect");var plugin=require("rtc-core/plugin");var EventEmitter=require("events").EventEmitter;var util=require("util");navigator.getUserMedia=navigator.getUserMedia||detect.call(navigator,"getUserMedia");window.URL=window.URL||detect("URL");window.MediaStream=detect("MediaStream");function Media(opts){var media=this;if(!(this instanceof Media)){return new Media(opts)}EventEmitter.call(this);if(opts&&MediaStream&&opts instanceof MediaStream){opts={stream:opts,capture:false,muted:false}}if(opts&&(opts.audio||opts.video)){opts={constraints:opts}}opts=extend({},{capture:true,muted:true,constraints:{video:{mandatory:{},optional:[]},audio:true,fake:typeof __testlingConsole!="undefined"}},opts);this.constraints=opts.constraints;this.name=opts.name;this.stream=opts.stream||null;this.muted=typeof opts.muted=="undefined"||opts.muted;this._bindings=[];this.plugin=plugin((opts||{}).plugins);if(this.plugin){media._pinst=this.plugin.init(opts,function(err){if(err){return media.emit("error",err)}if(opts.capture){media.capture()}})}else if(opts.capture){setTimeout(this.capture.bind(this),0)}}util.inherits(Media,EventEmitter);module.exports=Media;Media.prototype.capture=function(constraints,callback){var media=this;var handleEnd=this.emit.bind(this,"end");if(this.stream){return}if(typeof constraints=="function"){callback=constraints;constraints=this.constraints}if(typeof callback=="function"){this.once("capture",callback.bind(this))}if(typeof navigator.getUserMedia!="function"){return callback&&callback(new Error("Unable to capture user media"))}debug("getUserMedia, constraints: ",constraints||this.constraints);navigator.getUserMedia(constraints||this.constraints,function(stream){debug("sucessfully captured media stream: ",stream);if(typeof stream.addEventListener=="function"){stream.addEventListener("ended",handleEnd)}else{stream.onended=handleEnd}media.stream=stream;setTimeout(function(){media.emit("capture",stream)},0)},function(err){debug("getUserMedia attempt failed: ",err);media.emit("error",err)})};Media.prototype.render=function(target,opts,callback){if(Array.isArray(target)){console.log("WARNING: rtc-media render (as of 1.x) expects a single target");target=target[0]}if(typeof opts=="function"){callback=opts;opts={}}opts=opts||{};target=this._prepareElement(opts,target);if(!this.stream){this.once("capture",this._bindStream.bind(this))}else{this._bindStream(this.stream)}if(typeof callback=="function"){this.once("render",callback)}return target};Media.prototype.stop=function(opts){var media=this;if(!this.stream){return}this._unbind(opts);this.stream.stop();this.once("capture",media._bindStream.bind(media));this.stream=null};Media.prototype._createBinding=function(opts,element){this._bindings.push({el:element,opts:opts});return element};Media.prototype._prepareElement=function(opts,element){var parent;var validElement=element instanceof HTMLVideoElement||element instanceof HTMLAudioElement;var preserveAspectRatio=typeof opts.preserveAspectRatio=="undefined"||opts.preserveAspectRatio;if(!element){throw new Error("Cannot render media to a null element")}if(this.plugin&&typeof this.plugin.prepareElement=="function"){return this._createBinding(opts,this.plugin.prepareElement.call(this._pinst,opts,element))}validElement=validElement||typeof element.play=="function"&&(typeof element.srcObject!="undefined"||typeof element.mozSrcObject!="undefined"||typeof element.src!="undefined");if(!validElement){parent=element;element=document.createElement("video");if(preserveAspectRatio){element.setAttribute("preserveAspectRatio","")}parent.appendChild(element);element.setAttribute("data-playing",false)}if(element&&this.muted){element.muted=true;element.setAttribute("muted","")}return this._createBinding(opts,element)};Media.prototype._bindStream=function(stream){var media=this;var elements=[];var waiting=[];function checkWaiting(){if(waiting.length===0&&elements.length>0){media.emit("render",elements[0]);elements.map(function(el){el.setAttribute("data-playing",true)})}}function canPlay(evt){var el=evt.target||evt.srcElement;var videoIndex=elements.indexOf(el);if(videoIndex>=0){waiting.splice(videoIndex,1)}el.play();el.removeEventListener("canplay",canPlay);el.removeEventListener("loadedmetadata",canPlay);checkWaiting()}if(this.plugin&&typeof this.plugin.attachStream=="function"){return this.plugin.attachStream.call(this._pinst,stream,this._bindings)}elements=this._bindings.map(function(binding){if(typeof binding.el.srcObject!="undefined"){binding.el.srcObject=stream}else if(typeof binding.el.mozSrcObject!="undefined"){binding.el.mozSrcObject=stream}else{binding.el.src=media._createObjectURL(stream)||stream}binding.el.play();return binding.el});waiting=elements.filter(function(el){return el.readyState<3});waiting.forEach(function(el){el.addEventListener("canplay",canPlay,false);el.addEventListener("loadedmetadata",canPlay,false)});checkWaiting()};Media.prototype._unbind=function(opts){opts=opts||{};this._bindings.forEach(function(binding){var element=binding.el;element.src=null;if(element.mozSrcObject){element.mozSrcObject=null}if(element.currentSrc){element.currentSrc=null}})};Media.prototype._createObjectURL=function(stream){try{return window.URL.createObjectURL(stream)}catch(e){}};Media.prototype._handleSuccess=function(stream){this.stream=stream;this.emit("stream",stream)}},{"cog/extend":8,"cog/logger":9,events:1,"rtc-core/detect":10,"rtc-core/plugin":12,util:5}],8:[function(require,module,exports){"use strict";module.exports=function(target){[].slice.call(arguments,1).forEach(function(source){if(!source){return}for(var prop in source){target[prop]=source[prop]}});return target}},{}],9:[function(require,module,exports){"use strict";var active=[];var unleashListeners=[];var targets=[console];var logger=module.exports=function(name){var enabled=checkActive();function checkActive(){return enabled=active.indexOf("*")>=0||active.indexOf(name)>=0}unleashListeners[unleashListeners.length]=checkActive;return function(){var args=[].slice.call(arguments);if(typeof args[0]=="string"||args[0]instanceof String){args[0]=name+": "+args[0]}if(!enabled){return}targets.forEach(function(target){target.log.apply(target,args)})}};logger.reset=function(){targets=[];active=[];return logger.enable()};logger.to=function(target){targets=targets.concat(target||[]);return logger};logger.enable=function(){active=active.concat([].slice.call(arguments));unleashListeners.forEach(function(listener){listener()});return logger}},{}],10:[function(require,module,exports){(function(process){"use strict";var semver=require("semver");var browsers={chrome:[/Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],firefox:[/Firefox\/([0-9\.]+)(?:\s|$)/],opera:[/Opera\/([0-9\.]+)(?:\s|$)/],ie:[/Trident\/7\.0.*rv\:([0-9\.]+)\).*Gecko$/]};var detect=module.exports=function(target,prefixes){var prefixIdx;var prefix;var testName;var hostObject=this||(typeof window!="undefined"?window:undefined);if(!hostObject){return}prefixes=(prefixes||["ms","o","moz","webkit"]).concat("");for(prefixIdx=prefixes.length;prefixIdx--;){prefix=prefixes[prefixIdx];testName=prefix+(prefix?target.charAt(0).toUpperCase()+target.slice(1):target);if(typeof hostObject[testName]!="undefined"){detect.browser=detect.browser||prefix.toLowerCase();return hostObject[target]=hostObject[testName]}}};detect.moz=typeof navigator!="undefined"&&!!navigator.mozGetUserMedia;if(typeof navigator!="undefined"){Object.keys(browsers).forEach(function(key){var match=browsers[key].map(function(regex){return regex.exec(navigator.userAgent)}).filter(Boolean)[0];if(match){detect.browser=key;detect.browserVersion=detect.version=parseVersion(match[1])}});detect.browser=detect.browser||"unknown"}else{detect.browser="node";detect.browserVersion=detect.version=parseVersion(process.version.substr(1))}function parseVersion(version){var versionParts=version.split(".").slice(0,3);while(versionParts.length<3){versionParts.push("0")}return semver.clean(versionParts.join("."))||version}}).call(this,require("/home/admin/browserify-cdn/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"))},{"/home/admin/browserify-cdn/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":3,semver:11}],11:[function(require,module,exports){(function(exports){if(typeof module==="object"&&module.exports===exports)exports=module.exports=SemVer;exports.SEMVER_SPEC_VERSION="2.0.0";var re=exports.re=[];var src=exports.src=[];var R=0;var NUMERICIDENTIFIER=R++;src[NUMERICIDENTIFIER]="0|[1-9]\\d*";var NUMERICIDENTIFIERLOOSE=R++;src[NUMERICIDENTIFIERLOOSE]="[0-9]+";var NONNUMERICIDENTIFIER=R++;src[NONNUMERICIDENTIFIER]="\\d*[a-zA-Z-][a-zA-Z0-9-]*";var MAINVERSION=R++;src[MAINVERSION]="("+src[NUMERICIDENTIFIER]+")\\."+"("+src[NUMERICIDENTIFIER]+")\\."+"("+src[NUMERICIDENTIFIER]+")";var MAINVERSIONLOOSE=R++;src[MAINVERSIONLOOSE]="("+src[NUMERICIDENTIFIERLOOSE]+")\\."+"("+src[NUMERICIDENTIFIERLOOSE]+")\\."+"("+src[NUMERICIDENTIFIERLOOSE]+")";var PRERELEASEIDENTIFIER=R++;src[PRERELEASEIDENTIFIER]="(?:"+src[NUMERICIDENTIFIER]+"|"+src[NONNUMERICIDENTIFIER]+")";var PRERELEASEIDENTIFIERLOOSE=R++;src[PRERELEASEIDENTIFIERLOOSE]="(?:"+src[NUMERICIDENTIFIERLOOSE]+"|"+src[NONNUMERICIDENTIFIER]+")";var PRERELEASE=R++;src[PRERELEASE]="(?:-("+src[PRERELEASEIDENTIFIER]+"(?:\\."+src[PRERELEASEIDENTIFIER]+")*))";var PRERELEASELOOSE=R++;src[PRERELEASELOOSE]="(?:-?("+src[PRERELEASEIDENTIFIERLOOSE]+"(?:\\."+src[PRERELEASEIDENTIFIERLOOSE]+")*))";var BUILDIDENTIFIER=R++;src[BUILDIDENTIFIER]="[0-9A-Za-z-]+";var BUILD=R++;src[BUILD]="(?:\\+("+src[BUILDIDENTIFIER]+"(?:\\."+src[BUILDIDENTIFIER]+")*))";var FULL=R++;var FULLPLAIN="v?"+src[MAINVERSION]+src[PRERELEASE]+"?"+src[BUILD]+"?";src[FULL]="^"+FULLPLAIN+"$";var LOOSEPLAIN="[v=\\s]*"+src[MAINVERSIONLOOSE]+src[PRERELEASELOOSE]+"?"+src[BUILD]+"?";var LOOSE=R++;src[LOOSE]="^"+LOOSEPLAIN+"$";var GTLT=R++;src[GTLT]="((?:<|>)?=?)";var XRANGEIDENTIFIERLOOSE=R++;src[XRANGEIDENTIFIERLOOSE]=src[NUMERICIDENTIFIERLOOSE]+"|x|X|\\*";var XRANGEIDENTIFIER=R++;src[XRANGEIDENTIFIER]=src[NUMERICIDENTIFIER]+"|x|X|\\*";var XRANGEPLAIN=R++;src[XRANGEPLAIN]="[v=\\s]*("+src[XRANGEIDENTIFIER]+")"+"(?:\\.("+src[XRANGEIDENTIFIER]+")"+"(?:\\.("+src[XRANGEIDENTIFIER]+")"+"(?:("+src[PRERELEASE]+")"+")?)?)?";var XRANGEPLAINLOOSE=R++;src[XRANGEPLAINLOOSE]="[v=\\s]*("+src[XRANGEIDENTIFIERLOOSE]+")"+"(?:\\.("+src[XRANGEIDENTIFIERLOOSE]+")"+"(?:\\.("+src[XRANGEIDENTIFIERLOOSE]+")"+"(?:("+src[PRERELEASELOOSE]+")"+")?)?)?";var XRANGE=R++;src[XRANGE]="^"+src[GTLT]+"\\s*"+src[XRANGEPLAIN]+"$";var XRANGELOOSE=R++;src[XRANGELOOSE]="^"+src[GTLT]+"\\s*"+src[XRANGEPLAINLOOSE]+"$";var LONETILDE=R++;src[LONETILDE]="(?:~>?)";var TILDETRIM=R++;src[TILDETRIM]="(\\s*)"+src[LONETILDE]+"\\s+";re[TILDETRIM]=new RegExp(src[TILDETRIM],"g");var tildeTrimReplace="$1~";var TILDE=R++;
src[TILDE]="^"+src[LONETILDE]+src[XRANGEPLAIN]+"$";var TILDELOOSE=R++;src[TILDELOOSE]="^"+src[LONETILDE]+src[XRANGEPLAINLOOSE]+"$";var LONECARET=R++;src[LONECARET]="(?:\\^)";var CARETTRIM=R++;src[CARETTRIM]="(\\s*)"+src[LONECARET]+"\\s+";re[CARETTRIM]=new RegExp(src[CARETTRIM],"g");var caretTrimReplace="$1^";var CARET=R++;src[CARET]="^"+src[LONECARET]+src[XRANGEPLAIN]+"$";var CARETLOOSE=R++;src[CARETLOOSE]="^"+src[LONECARET]+src[XRANGEPLAINLOOSE]+"$";var COMPARATORLOOSE=R++;src[COMPARATORLOOSE]="^"+src[GTLT]+"\\s*("+LOOSEPLAIN+")$|^$";var COMPARATOR=R++;src[COMPARATOR]="^"+src[GTLT]+"\\s*("+FULLPLAIN+")$|^$";var COMPARATORTRIM=R++;src[COMPARATORTRIM]="(\\s*)"+src[GTLT]+"\\s*("+LOOSEPLAIN+"|"+src[XRANGEPLAIN]+")";re[COMPARATORTRIM]=new RegExp(src[COMPARATORTRIM],"g");var comparatorTrimReplace="$1$2$3";var HYPHENRANGE=R++;src[HYPHENRANGE]="^\\s*("+src[XRANGEPLAIN]+")"+"\\s+-\\s+"+"("+src[XRANGEPLAIN]+")"+"\\s*$";var HYPHENRANGELOOSE=R++;src[HYPHENRANGELOOSE]="^\\s*("+src[XRANGEPLAINLOOSE]+")"+"\\s+-\\s+"+"("+src[XRANGEPLAINLOOSE]+")"+"\\s*$";var STAR=R++;src[STAR]="(<|>)?=?\\s*\\*";for(var i=0;i<R;i++){if(!re[i])re[i]=new RegExp(src[i])}exports.parse=parse;function parse(version,loose){var r=loose?re[LOOSE]:re[FULL];return r.test(version)?new SemVer(version,loose):null}exports.valid=valid;function valid(version,loose){var v=parse(version,loose);return v?v.version:null}exports.clean=clean;function clean(version,loose){var s=parse(version,loose);return s?s.version:null}exports.SemVer=SemVer;function SemVer(version,loose){if(version instanceof SemVer){if(version.loose===loose)return version;else version=version.version}else if(typeof version!=="string"){throw new TypeError("Invalid Version: "+version)}if(!(this instanceof SemVer))return new SemVer(version,loose);this.loose=loose;var m=version.trim().match(loose?re[LOOSE]:re[FULL]);if(!m)throw new TypeError("Invalid Version: "+version);this.raw=version;this.major=+m[1];this.minor=+m[2];this.patch=+m[3];if(!m[4])this.prerelease=[];else this.prerelease=m[4].split(".").map(function(id){return/^[0-9]+$/.test(id)?+id:id});this.build=m[5]?m[5].split("."):[];this.format()}SemVer.prototype.format=function(){this.version=this.major+"."+this.minor+"."+this.patch;if(this.prerelease.length)this.version+="-"+this.prerelease.join(".");return this.version};SemVer.prototype.inspect=function(){return'<SemVer "'+this+'">'};SemVer.prototype.toString=function(){return this.version};SemVer.prototype.compare=function(other){if(!(other instanceof SemVer))other=new SemVer(other,this.loose);return this.compareMain(other)||this.comparePre(other)};SemVer.prototype.compareMain=function(other){if(!(other instanceof SemVer))other=new SemVer(other,this.loose);return compareIdentifiers(this.major,other.major)||compareIdentifiers(this.minor,other.minor)||compareIdentifiers(this.patch,other.patch)};SemVer.prototype.comparePre=function(other){if(!(other instanceof SemVer))other=new SemVer(other,this.loose);if(this.prerelease.length&&!other.prerelease.length)return-1;else if(!this.prerelease.length&&other.prerelease.length)return 1;else if(!this.prerelease.length&&!other.prerelease.length)return 0;var i=0;do{var a=this.prerelease[i];var b=other.prerelease[i];if(a===undefined&&b===undefined)return 0;else if(b===undefined)return 1;else if(a===undefined)return-1;else if(a===b)continue;else return compareIdentifiers(a,b)}while(++i)};SemVer.prototype.inc=function(release){switch(release){case"premajor":this.inc("major");this.inc("pre");break;case"preminor":this.inc("minor");this.inc("pre");break;case"prepatch":this.inc("patch");this.inc("pre");break;case"prerelease":if(this.prerelease.length===0)this.inc("patch");this.inc("pre");break;case"major":this.major++;this.minor=-1;case"minor":this.minor++;this.patch=0;this.prerelease=[];break;case"patch":if(this.prerelease.length===0)this.patch++;this.prerelease=[];break;case"pre":if(this.prerelease.length===0)this.prerelease=[0];else{var i=this.prerelease.length;while(--i>=0){if(typeof this.prerelease[i]==="number"){this.prerelease[i]++;i=-2}}if(i===-1)this.prerelease.push(0)}break;default:throw new Error("invalid increment argument: "+release)}this.format();return this};exports.inc=inc;function inc(version,release,loose){try{return new SemVer(version,loose).inc(release).version}catch(er){return null}}exports.compareIdentifiers=compareIdentifiers;var numeric=/^[0-9]+$/;function compareIdentifiers(a,b){var anum=numeric.test(a);var bnum=numeric.test(b);if(anum&&bnum){a=+a;b=+b}return anum&&!bnum?-1:bnum&&!anum?1:a<b?-1:a>b?1:0}exports.rcompareIdentifiers=rcompareIdentifiers;function rcompareIdentifiers(a,b){return compareIdentifiers(b,a)}exports.compare=compare;function compare(a,b,loose){return new SemVer(a,loose).compare(b)}exports.compareLoose=compareLoose;function compareLoose(a,b){return compare(a,b,true)}exports.rcompare=rcompare;function rcompare(a,b,loose){return compare(b,a,loose)}exports.sort=sort;function sort(list,loose){return list.sort(function(a,b){return exports.compare(a,b,loose)})}exports.rsort=rsort;function rsort(list,loose){return list.sort(function(a,b){return exports.rcompare(a,b,loose)})}exports.gt=gt;function gt(a,b,loose){return compare(a,b,loose)>0}exports.lt=lt;function lt(a,b,loose){return compare(a,b,loose)<0}exports.eq=eq;function eq(a,b,loose){return compare(a,b,loose)===0}exports.neq=neq;function neq(a,b,loose){return compare(a,b,loose)!==0}exports.gte=gte;function gte(a,b,loose){return compare(a,b,loose)>=0}exports.lte=lte;function lte(a,b,loose){return compare(a,b,loose)<=0}exports.cmp=cmp;function cmp(a,op,b,loose){var ret;switch(op){case"===":ret=a===b;break;case"!==":ret=a!==b;break;case"":case"=":case"==":ret=eq(a,b,loose);break;case"!=":ret=neq(a,b,loose);break;case">":ret=gt(a,b,loose);break;case">=":ret=gte(a,b,loose);break;case"<":ret=lt(a,b,loose);break;case"<=":ret=lte(a,b,loose);break;default:throw new TypeError("Invalid operator: "+op)}return ret}exports.Comparator=Comparator;function Comparator(comp,loose){if(comp instanceof Comparator){if(comp.loose===loose)return comp;else comp=comp.value}if(!(this instanceof Comparator))return new Comparator(comp,loose);this.loose=loose;this.parse(comp);if(this.semver===ANY)this.value="";else this.value=this.operator+this.semver.version}var ANY={};Comparator.prototype.parse=function(comp){var r=this.loose?re[COMPARATORLOOSE]:re[COMPARATOR];var m=comp.match(r);if(!m)throw new TypeError("Invalid comparator: "+comp);this.operator=m[1];if(!m[2])this.semver=ANY;else{this.semver=new SemVer(m[2],this.loose);if(this.operator==="<"&&!this.semver.prerelease.length){this.semver.prerelease=["0"];this.semver.format()}}};Comparator.prototype.inspect=function(){return'<SemVer Comparator "'+this+'">'};Comparator.prototype.toString=function(){return this.value};Comparator.prototype.test=function(version){return this.semver===ANY?true:cmp(version,this.operator,this.semver,this.loose)};exports.Range=Range;function Range(range,loose){if(range instanceof Range&&range.loose===loose)return range;if(!(this instanceof Range))return new Range(range,loose);this.loose=loose;this.raw=range;this.set=range.split(/\s*\|\|\s*/).map(function(range){return this.parseRange(range.trim())},this).filter(function(c){return c.length});if(!this.set.length){throw new TypeError("Invalid SemVer Range: "+range)}this.format()}Range.prototype.inspect=function(){return'<SemVer Range "'+this.range+'">'};Range.prototype.format=function(){this.range=this.set.map(function(comps){return comps.join(" ").trim()}).join("||").trim();return this.range};Range.prototype.toString=function(){return this.range};Range.prototype.parseRange=function(range){var loose=this.loose;range=range.trim();var hr=loose?re[HYPHENRANGELOOSE]:re[HYPHENRANGE];range=range.replace(hr,hyphenReplace);range=range.replace(re[COMPARATORTRIM],comparatorTrimReplace);range=range.replace(re[TILDETRIM],tildeTrimReplace);range=range.replace(re[CARETTRIM],caretTrimReplace);range=range.split(/\s+/).join(" ");var compRe=loose?re[COMPARATORLOOSE]:re[COMPARATOR];var set=range.split(" ").map(function(comp){return parseComparator(comp,loose)}).join(" ").split(/\s+/);if(this.loose){set=set.filter(function(comp){return!!comp.match(compRe)})}set=set.map(function(comp){return new Comparator(comp,loose)});return set};exports.toComparators=toComparators;function toComparators(range,loose){return new Range(range,loose).set.map(function(comp){return comp.map(function(c){return c.value}).join(" ").trim().split(" ")})}function parseComparator(comp,loose){comp=replaceCarets(comp,loose);comp=replaceTildes(comp,loose);comp=replaceXRanges(comp,loose);comp=replaceStars(comp,loose);return comp}function isX(id){return!id||id.toLowerCase()==="x"||id==="*"}function replaceTildes(comp,loose){return comp.trim().split(/\s+/).map(function(comp){return replaceTilde(comp,loose)}).join(" ")}function replaceTilde(comp,loose){var r=loose?re[TILDELOOSE]:re[TILDE];return comp.replace(r,function(_,M,m,p,pr){var ret;if(isX(M))ret="";else if(isX(m))ret=">="+M+".0.0-0 <"+(+M+1)+".0.0-0";else if(isX(p))ret=">="+M+"."+m+".0-0 <"+M+"."+(+m+1)+".0-0";else if(pr){if(pr.charAt(0)!=="-")pr="-"+pr;ret=">="+M+"."+m+"."+p+pr+" <"+M+"."+(+m+1)+".0-0"}else ret=">="+M+"."+m+"."+p+"-0"+" <"+M+"."+(+m+1)+".0-0";return ret})}function replaceCarets(comp,loose){return comp.trim().split(/\s+/).map(function(comp){return replaceCaret(comp,loose)}).join(" ")}function replaceCaret(comp,loose){var r=loose?re[CARETLOOSE]:re[CARET];return comp.replace(r,function(_,M,m,p,pr){var ret;if(isX(M))ret="";else if(isX(m))ret=">="+M+".0.0-0 <"+(+M+1)+".0.0-0";else if(isX(p)){if(M==="0")ret=">="+M+"."+m+".0-0 <"+M+"."+(+m+1)+".0-0";else ret=">="+M+"."+m+".0-0 <"+(+M+1)+".0.0-0"}else if(pr){if(pr.charAt(0)!=="-")pr="-"+pr;if(M==="0"){if(m==="0")ret="="+M+"."+m+"."+p+pr;else ret=">="+M+"."+m+"."+p+pr+" <"+M+"."+(+m+1)+".0-0"}else ret=">="+M+"."+m+"."+p+pr+" <"+(+M+1)+".0.0-0"}else{if(M==="0"){if(m==="0")ret="="+M+"."+m+"."+p;else ret=">="+M+"."+m+"."+p+"-0"+" <"+M+"."+(+m+1)+".0-0"}else ret=">="+M+"."+m+"."+p+"-0"+" <"+(+M+1)+".0.0-0"}return ret})}function replaceXRanges(comp,loose){return comp.split(/\s+/).map(function(comp){return replaceXRange(comp,loose)}).join(" ")}function replaceXRange(comp,loose){comp=comp.trim();var r=loose?re[XRANGELOOSE]:re[XRANGE];return comp.replace(r,function(ret,gtlt,M,m,p,pr){var xM=isX(M);var xm=xM||isX(m);var xp=xm||isX(p);var anyX=xp;if(gtlt==="="&&anyX)gtlt="";if(gtlt&&anyX){if(xM)M=0;if(xm)m=0;if(xp)p=0;if(gtlt===">"){gtlt=">=";if(xM){}else if(xm){M=+M+1;m=0;p=0}else if(xp){m=+m+1;p=0}}ret=gtlt+M+"."+m+"."+p+"-0"}else if(xM){ret="*"}else if(xm){ret=">="+M+".0.0-0 <"+(+M+1)+".0.0-0"}else if(xp){ret=">="+M+"."+m+".0-0 <"+M+"."+(+m+1)+".0-0"}return ret})}function replaceStars(comp,loose){return comp.trim().replace(re[STAR],"")}function hyphenReplace($0,from,fM,fm,fp,fpr,fb,to,tM,tm,tp,tpr,tb){if(isX(fM))from="";else if(isX(fm))from=">="+fM+".0.0-0";else if(isX(fp))from=">="+fM+"."+fm+".0-0";else from=">="+from;if(isX(tM))to="";else if(isX(tm))to="<"+(+tM+1)+".0.0-0";else if(isX(tp))to="<"+tM+"."+(+tm+1)+".0-0";else if(tpr)to="<="+tM+"."+tm+"."+tp+"-"+tpr;else to="<="+to;return(from+" "+to).trim()}Range.prototype.test=function(version){if(!version)return false;for(var i=0;i<this.set.length;i++){if(testSet(this.set[i],version))return true}return false};function testSet(set,version){for(var i=0;i<set.length;i++){if(!set[i].test(version))return false}return true}exports.satisfies=satisfies;function satisfies(version,range,loose){try{range=new Range(range,loose)}catch(er){return false}return range.test(version)}exports.maxSatisfying=maxSatisfying;function maxSatisfying(versions,range,loose){return versions.filter(function(version){return satisfies(version,range,loose)}).sort(function(a,b){return rcompare(a,b,loose)})[0]||null}exports.validRange=validRange;function validRange(range,loose){try{return new Range(range,loose).range||"*"}catch(er){return null}}exports.ltr=ltr;function ltr(version,range,loose){return outside(version,range,"<",loose)}exports.gtr=gtr;function gtr(version,range,loose){return outside(version,range,">",loose)}exports.outside=outside;function outside(version,range,hilo,loose){version=new SemVer(version,loose);range=new Range(range,loose);var gtfn,ltefn,ltfn,comp,ecomp;switch(hilo){case">":gtfn=gt;ltefn=lte;ltfn=lt;comp=">";ecomp=">=";break;case"<":gtfn=lt;ltefn=gte;ltfn=gt;comp="<";ecomp="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(satisfies(version,range,loose)){return false}for(var i=0;i<range.set.length;++i){var comparators=range.set[i];var high=null;var low=null;comparators.forEach(function(comparator){high=high||comparator;low=low||comparator;if(gtfn(comparator.semver,high.semver,loose)){high=comparator}else if(ltfn(comparator.semver,low.semver,loose)){low=comparator}});if(high.operator===comp||high.operator===ecomp){return false}if((!low.operator||low.operator===comp)&&ltefn(version,low.semver)){return false}else if(low.operator===ecomp&&ltfn(version,low.semver)){return false}}return true}if(typeof define==="function"&&define.amd)define(exports)})(typeof exports==="object"?exports:typeof define==="function"&&define.amd?{}:semver={})},{}],12:[function(require,module,exports){var detect=require("./detect");var requiredFunctions=["init"];function isSupported(plugin){return plugin&&typeof plugin.supported=="function"&&plugin.supported(detect)}function isValid(plugin){var supportedFunctions=requiredFunctions.filter(function(fn){return typeof plugin[fn]=="function"});return supportedFunctions.length===requiredFunctions.length}module.exports=function(plugins){return[].concat(plugins||[]).filter(isSupported).filter(isValid)[0]}},{"./detect":10}]},{},[]);var media=require("rtc-media");var localMedia=media({plugins:[require("rtc-plugin-temasys")]});localMedia.render(document.body);
{
"name": "requirebin-sketch",
"version": "1.0.0",
"dependencies": {
"rtc-plugin-temasys": "0.0.1",
"rtc-media": "1.6.5"
}
}
<style type='text/css'>html, body { margin: 0; padding: 0; border: 0; }
body, html { height: 100%; width: 100%; }</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment