diff --git a/legacy/v0.4.x/gest.js b/legacy/v0.4.x/gest.js index 15bceb0..698896c 100755 --- a/legacy/v0.4.x/gest.js +++ b/legacy/v0.4.x/gest.js @@ -210,7 +210,7 @@ window.gest = (function (document) { stream = LocalMediaStream; window.URL = window.URL || window.webkitURL; - video.src = window.URL.createObjectURL(stream); + video.srcObject = stream; video.addEventListener('canplaythrough', //play the video once it can play through diff --git a/legacy/v0.4.x/gest.min.js b/legacy/v0.4.x/gest.min.js index b8b10ad..0ee23c0 100644 --- a/legacy/v0.4.x/gest.min.js +++ b/legacy/v0.4.x/gest.min.js @@ -7,4 +7,4 @@ * @license: MIT License */ -window.gest=function(e){function L(e,t,n){e=e/255;t=t/255;n=n/255;var r=Math.max(e,t,n);var i=Math.min(e,t,n);var s,o,u=r;var a=r-i;o=r===0?0:a/r;if(r==i){s=0}else{switch(r){case e:s=(t-n)/a+(tD;switch(B){case 0:if(i){B=1;M={x:n.x,y:n.y,d:n.d}}break;case 1:B=2;var s=n.x-M.x,o=n.y-M.y;var u=Math.abs(o)_&&u){m({direction:"Right",right:true})}if(o>_&&!u){if(r>P){m({direction:"Long down",down:true})}else{m({direction:"Down",down:true})}}else if(o<-_&&!u){if(r>P){m({direction:"Long up",up:true})}else{m({direction:"Up",up:true})}}U(''+t.direction+"",50);break;case 2:if(!i){B=0}break;default:break}}var t={};navigator.getUserMedia=navigator.getUserMedia||navigator.webkitGetUserMedia;var n={framerate:25,videoCompressionRate:5,debug:false,locked:false};var i=false;var s=false;var o;var u,f,l,c,h,p,d=0,v=0;var m=function(r){t.direction=r.direction||null;t.up=r.up||false;t.down=r.down||false;t.left=r.left||false;t.right=r.right||false;t.error=r.error||null;if((t.up||t.down||t.left||t.right)&&n.locked){if(n.debug){console.log("Locked. Gesture skipped.")}return false}else{n.locked=true;setTimeout(function(){n.locked=false},gest.options.locking)}try{if(e.createEventObject){return e.fireEvent("on"+t.eventType,t)}else{return e.dispatchEvent(t)}}catch(i){console.error(i);console.log(t);return false}};gest=function(){function r(){e.removeEventListener("DOMContentLoaded",r,false);window.removeEventListener("load",r,false);if(e.createEventObject){t=e.createEventObject();t.eventType="gest"}else{t=e.createEvent("Event");t.initEvent("gest",true,true)}if(y()){i=true}if(s&&i){return gest.start()}else{return i}}this.options={skinFilter:false,messages:true,locking:0,debug:function(e){n.debug=e;if(e){c.setAttribute("style","visibility: visible; position: fixed; left: 0; top: 0; width: 100%; height: 100%; opacity: 1;")}else{c.setAttribute("style","visibility: hidden; position: fixed; left: 0; top: 0; width: 100%; height: 100%; opacity: 1;")}return n.debug}};if(e.readyState==="complete"){r()}else{e.addEventListener("DOMContentLoaded",r,false);window.addEventListener("load",r,false)}return true};var y=function(){p=e.createElement("div");e.body.appendChild(p);if(!navigator.getUserMedia){F(0);return false}u=e.createElement("video");u.width=300;u.setAttribute("style","visibility: hidden;");e.body.appendChild(u);f=e.createElement("canvas");f.setAttribute("style","width: 300px; display: none;");e.body.appendChild(f);l=f.getContext("2d");c=e.createElement("canvas");c.setAttribute("style","visibility: hidden;");e.body.appendChild(c);h=c.getContext("2d");return true};gest.prototype.start=function(){s=true;if(!navigator.getUserMedia||!i){return false}if(!u||!(u.paused||u.ended||u.seeking||u.readyStateGo forth and gesture!")})},function(e){if(e.PERMISSION_DENIED){F(10,e)}else if(e.NOT_SUPPORTED_ERROR){F(11,e)}else if(e.MANDATORY_UNSATISFIED_ERROR){F(12,e)}else{F(13,e)}})}else{F(0)}return!!navigator.getUserMedia};gest.prototype.stop=function(){if(!navigator.getUserMedia){return false}if(u){u.src=""}return!!o.stop()};var w=function(){f.width=d;c.width=d;f.height=v;c.height=v;l.drawImage(u,d,0,-d,v);var e=l.getImageData(0,0,d,v);h.putImageData(e,0,0);if(gest.options.skinFilter){O(k(e),150)}else{O(e,150)}};var E=0,S=.1,x=.3,T=1,N=.4,C=1;var k=function(e){skin_filter=l.getImageData(0,0,d,v);var t=skin_filter.width*skin_filter.height;var n=t*4;var i=0;for(var s=0;sE&&hsv[0].59&&hsv[0]<1)&&hsv[1]>x&&hsv[1]N&&hsv[2]t){delt.data[o]=255;delt.data[o+1]=0;delt.data[o+2]=0;delt.data[o+3]=255;i+=1;n+=o/4%d;r+=Math.floor(o/4/delt.height)}else{delt.data[o]=e.data[o];delt.data[o+1]=e.data[o+1];delt.data[o+2]=e.data[o+2];delt.data[o+3]=e.data[o+3]}}}if(i){j({x:n,y:r,d:i})}A=e;h.putImageData(delt,0,0)};var M=false,_=2,D=300,P=1e3,H=0,B=0;var F=function(e,t){switch(e){case 0:_error={code:e,message:"Your web browser does not support gest.js :(
Try using Google Chrome."};break;case 1:_error={code:e,message:"gest.js could not start."};break;case 2:_error={code:e,message:"gest.js has already started."};break;case 10:_error={code:e,message:"DEEEENIED! The user denied permission to use a media device required for the operation.",obj:t};break;case 11:_error={code:e,message:"A constraint specified is not supported by the web browser.",obj:t};break;case 12:_error={code:e,message:"No media tracks of the type specified in the constraints are found.",obj:t};break;case 13:_error={code:e,message:"Couldn't get user media.",obj:t};break;default:_error=null;break}if(n.debug){console.error(_error)}U(_error.message,4e3);m({error:_error})};var I=null,q=null,R=false;var U=function(t,n){if(!gest.options.messages||!t){return false}if(R){R=true;return false}var r=n||2500;window.clearTimeout(I);window.clearInterval(q);var i='visibility: visible; position: fixed; left: 50%; top: 40%; min-height: 80px; margin-top: -50px; padding: 10px; background-color: #222222; border-radius: 10px; z-index: 100; font: normal 15px/1.1 "Helvetica Neue", Helvetica, Arial, sans-serif; color: #FFFFFF; font-size: 35px; text-align: center;';if(e.width>767||window.innerWidth>767){i+="margin-left: -250px; width: 500px"}else{i+="margin-left: -40%; width:80%; min-width: 250px"}var s=1;p.innerHTML=t;p.setAttribute("style",i);I=window.setTimeout(function(){q=window.setInterval(function(){if(s-.1<=0){window.clearInterval(q);p.setAttribute("style","visibility: hidden")}else{s-=.05;p.setAttribute("style","opacity: "+s+";"+i)}R=false},40)},r);if(r>=2e3){R=true}return true};return new gest}(document) \ No newline at end of file +window.gest=function(e){navigator.getUserMedia=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia;var t,r,i,n,o={},s={framerate:25,videoCompressionRate:5,debug:!1,locked:!1},a=!1,d=!1,c=function(t){if(o.direction=t.direction||null,o.up=t.up||!1,o.down=t.down||!1,o.left=t.left||!1,o.right=t.right||!1,o.error=t.error||null,(o.up||o.down||o.left||o.right)&&s.locked)return s.debug&&console.log("Locked. Gesture skipped."),!1;s.locked=!0,setTimeout(function(){s.locked=!1},gest.options.locking);try{return e.createEventObject?e.fireEvent("on"+o.eventType,o):e.dispatchEvent(o)}catch(e){return console.error(e),console.log(o),!1}};gest=function(){function t(){return e.removeEventListener("DOMContentLoaded",t,!1),window.removeEventListener("load",t,!1),e.createEventObject?(o=e.createEventObject()).eventType="gest":(o=e.createEvent("Event")).initEvent("gest",!0,!0),l()&&(a=!0),d&&a?gest.start():a}return this.options={skinFilter:!1,messages:!0,locking:0,debug:function(e){return s.debug=e,e?n.setAttribute("style","visibility: visible; position: fixed; left: 0; top: 0; width: 100%; height: 100%; opacity: 1;"):n.setAttribute("style","visibility: hidden; position: fixed; left: 0; top: 0; width: 100%; height: 100%; opacity: 1;"),s.debug}},"complete"===e.readyState?t():(e.addEventListener("DOMContentLoaded",t,!1),window.addEventListener("load",t,!1)),!0};var l=function(){return navigator.getUserMedia?((r=e.createElement("video")).width=300,r.setAttribute("style","display: none;"),e.body.appendChild(r),(i=e.createElement("canvas")).setAttribute("style","width: 300px; display: none;"),e.body.appendChild(i),i.getContext("2d"),(n=e.createElement("canvas")).setAttribute("style","display: none;"),e.body.appendChild(n),n.getContext("2d"),!0):(u(0),!1)};gest.prototype.start=function(){return d=!0,!(!navigator.getUserMedia||!a)&&(r&&(r.paused||r.ended||r.seeking||r.readyStateGo forth and gesture!")})},function(e){e.PERMISSION_DENIED?u(10,e):e.NOT_SUPPORTED_ERROR?u(11,e):e.MANDATORY_UNSATISFIED_ERROR?u(12,e):u(13,e)}):u(0),!!navigator.getUserMedia):(u(2),!1))},gest.prototype.stop=function(){return!!navigator.getUserMedia&&(r&&(r.src=""),!!t.stop())};var u=function(e,t){switch(e){case 0:_error={code:e,message:"Your web browser does not support gest.js :(
Try using Google Chrome."};break;case 1:_error={code:e,message:"gest.js could not start."};break;case 2:_error={code:e,message:"gest.js has already started."};break;case 10:_error={code:e,message:"DEEEENIED! The user denied permission to use a media device required for the operation.",obj:t};break;case 11:_error={code:e,message:"A constraint specified is not supported by the web browser.",obj:t};break;case 12:_error={code:e,message:"No media tracks of the type specified in the constraints are found.",obj:t};break;case 13:_error={code:e,message:"Couldn't get user media.",obj:t};break;default:_error=null}s.debug&&console.error(_error),c({error:_error})},g=null,p=null,v=!1,b=function(t,r){if(!gest.options.messages||!t)return!1;if(v)return v=!0,!1;var i=r||2500;window.clearTimeout(g),window.clearInterval(p);var n='visibility: visible; position: fixed; left: 50%; top: 40%; min-height: 80px; margin-top: -50px; padding: 10px; background-color: #222222; border-radius: 10px; z-index: 100; font: normal 15px/1.1 "Helvetica Neue", Helvetica, Arial, sans-serif; color: #FFFFFF; font-size: 35px; text-align: center;';e.width>767||window.innerWidth>767?n+="margin-left: -250px; width: 500px":n+="margin-left: -40%; width:80%; min-width: 250px";var o=1;return messageContainer.innerHTML=t,messageContainer.setAttribute("style",n),g=window.setTimeout(function(){p=window.setInterval(function(){o-.1<=0?(window.clearInterval(p),messageContainer.setAttribute("style","visibility: hidden")):(o-=.05,messageContainer.setAttribute("style","opacity: "+o+";"+n)),v=!1},40)},i),i>=2e3&&(v=!0),!0};return new gest}(document); \ No newline at end of file diff --git a/src/gest.js b/src/gest.js index 3ed1457..8197516 100644 --- a/src/gest.js +++ b/src/gest.js @@ -554,7 +554,7 @@ window.gest = (function (window) { stream = _LocalMediaStream; window.URL = window.URL || window.webkitURL; - video.src = window.URL.createObjectURL(stream); + video.srcObject = stream; utils.addEventListener('canplaythrough', video, //play the video once it can play through diff --git a/src/gest.min.js b/src/gest.min.js index e1d7d39..ad288fd 100644 --- a/src/gest.min.js +++ b/src/gest.min.js @@ -7,4 +7,4 @@ * @license: MIT License */ - window.gest=function(e){"use strict";navigator.getUserMedia=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia;var t={framerate:25,videoCompressionRate:4,sensitivity:80,skinFilter:false,debug:{state:false,canvas:null,context:null}},n=false,r=false,i,s,o,u,a=function(){function t(){m.removeEventListener("DOMContentLoaded",document,t);m.removeEventListener("load",e,t);if(l()){n=true}if(r&&n){return e.gest.start()}return false}if(a.prototype._singletonInstance){return a.prototype._singletonInstance}a.prototype._singletonInstance=this;if(document.readyState==="complete"){t.call()}else{m.addEventListener("DOMContentLoaded",document,t);m.addEventListener("load",e,t)}return true},f=function(e){var t=m.createCustomEvent("gest",document);t.direction=e.direction||null;t.up=e.up||false;t.down=e.down||false;t.left=e.left||false;t.right=e.right||false;t.error=e.error||null;m.fireEvent(t)},l=function(){s=document.createElement("video");o=document.createElement("canvas");if(!!s.canPlayType&&!!(o.getContext&&o.getContext("2d"))&&!!navigator.getUserMedia){s.width=300;s.height=225;s.setAttribute("style","visibility: hidden;");document.body.appendChild(s);o.setAttribute("style","width: 300px; display: none;");document.body.appendChild(o);u=o.getContext("2d")}else{c(0);return false}return true},c=function(e,n){var r;switch(e){case 0:r={code:e,message:"gest.js can't run in your browser :("};break;case 1:r={code:e,message:"gest.js could not start."};break;case 2:r={code:e,message:"gest.js has already started."};break;case 10:r={code:e,message:"DEEENIED! gest.js needs webcam access.",obj:n};break;case 11:r={code:e,message:"A constraint specified is not supported by the web-browser.",obj:n};break;case 12:r={code:e,message:"No media tracks of the type specified in the constraints are found.",obj:n};break;case 13:r={code:e,message:"Couldn't get access to webcam.",obj:n};break;default:r=null;break}if(t.debug.state){console.error(r.message)}f({error:r})},h=function(e,n){try{u.drawImage(s,0,0,e,n);var r=u.getImageData(0,0,e,n);if(t.skinFilter){d.get(p.apply(r),t.sensitivity,e,n)}else{d.get(r,t.sensitivity,e,n)}}catch(i){if(i.name==="NS_ERROR_NOT_AVAILABLE"){return false}else{throw i}}},p={huemin:0,huemax:.1,satmin:.3,satmax:1,valmin:.4,valmax:1,rgb2hsv:function(e,t,n){e=e/255;t=t/255;n=n/255;var r=Math.max(e,t,n),i=Math.min(e,t,n),s,o,u=r,a=r-i;if(r===0){o=0}else{o=a/r}if(r==i){s=0}else{switch(r){case e:s=(t-n)/a+(tthis.huemin&&l[0].59&&l[0]<1)&&l[1]>this.satmin&&l[1]this.valmin&&l[2]=0){var p=Math.abs(e.data[c]-this.priorFrame.data[c])+Math.abs(e.data[c+1]-this.priorFrame.data[c+1])+Math.abs(e.data[c+2]-this.priorFrame.data[c+2]);if(p>h*Math.abs((n-100)/100)){s.data[c]=255;s.data[c+1]=0;s.data[c+2]=0;s.data[c+3]=255;f+=1;o+=c/4%s.width;a+=Math.floor(c/4/s.height)}else{s.data[c]=e.data[c];s.data[c+1]=e.data[c+1];s.data[c+2]=e.data[c+2];s.data[c+3]=e.data[c+3]}}}if(f>0){v.search({x:o,y:a,d:f});if(t.debug.state&&t.debug.context.putImageData){t.debug.canvas.width=r;t.debug.canvas.height=i;t.debug.context.putImageData(s,0,0)}}this.priorFrame=e}},v={prior:false,filteringFactor:.9,filteredTotal:0,minTotalChange:300,minDirChange:2,longDirChange:7,state:0,search:function(e){var t={x:e.x/e.d,y:e.y/e.d,d:e.d};this.filteredTotal=this.filteringFactor*this.filteredTotal+(1-this.filteringFactor)*t.d;var n=t.d-this.filteredTotal,r=n>this.minTotalChange;switch(this.state){case 0:if(r){this.state=1;v.prior=t}break;case 1:this.state=2;var i=t.x-v.prior.x,s=t.y-v.prior.y,o=Math.abs(s)this.minDirChange&&o){f({direction:"Left",left:true})}if(s>this.minDirChange&&!o){if(Math.abs(s)>this.longDirChange){f({direction:"Long down",down:true})}else{f({direction:"Down",down:true})}}else if(s<-this.minDirChange&&!o){if(Math.abs(s)>this.longDirChange){f({direction:"Long up",up:true})}else{f({direction:"Up",up:true})}}break;case 2:if(!r){this.state=0}break;default:break}}},m={htmlEvents:{onload:1,onunload:1,onblur:1,onchange:1,onfocus:1,onreset:1,onselect:1,onsubmit:1,onabort:1,onkeydown:1,onkeypress:1,onkeyup:1,onclick:1,ondblclick:1,onmousedown:1,onmousemove:1,onmouseout:1,onmouseover:1,onmouseup:1},addEventListener:function(e,t,n){if(t.addEventListener)t.addEventListener(e,n,false);else if(t.attachEvent&&this.htmlEvents["on"+e]){t.attachEvent("on"+e,n)}else{t["on"+e]=n}},removeEventListener:function(e,t,n){if(t.removeEventListener)t.removeEventListener(e,n,false);else if(t.detachEvent&&this.htmlEvents["on"+e]){t.detachEvent("on"+e,n)}else{t["on"+e]=null}},createCustomEvent:function(e,t){try{var n;if(t.createEvent){n=t.createEvent("Event");n.initEvent(e,true,true)}else if(t.createEventObject){n=t.createEventObject();n.eventType=e}n.evntName=e;n.evntElement=t;return n}catch(r){console.error(r);return false}},fireEvent:function(e){try{if(e.evntElement.dispatchEvent){e.evntElement.dispatchEvent(e)}else if(e.evntElement.fireEvent&&this.htmlEvents["on"+e.evntName]){e.evntElement.fireEvent("on"+e.eventType,e)}else if(e.evntElement[e.evntName]){e.evntElement[e.evntName]()}else if(e.evntElement["on"+e.evntName]){e.evntElement["on"+e.evntName]()}}catch(t){console.error(t)}}};a.prototype.start=function(){r=true;if(!n){return false}if(!s||!(s.paused||s.ended||s.seeking||s.readyState=100){t.sensitivity=100}else if(e<=0){t.sensitivity=0}else{t.sensitivity=e}},debug:function(e){t.debug.state=e;if(e){t.debug.canvas=document.createElement("canvas");t.debug.canvas.setAttribute("style","width: 100%; height: 100%; display: block; position: absolute; top: 0; left: 0;");document.body.appendChild(t.debug.canvas);t.debug.context=t.debug.canvas.getContext("2d")}else{t.debug.canvas.setAttribute("style","display: none;");t.debug.canvas.parentNode.removeChild(t.debug.canvas)}return t.debug},skinFilter:function(e){t.skinFilter=e}};return new a}(window) \ No newline at end of file +window.gest=function(e){"use strict";navigator.getUserMedia=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia;var t,n,a,i,o={framerate:25,videoCompressionRate:4,sensitivity:80,skinFilter:!1,debug:{state:!1,canvas:null,context:null}},r=!1,s=!1,d=function(){if(d.prototype._singletonInstance)return d.prototype._singletonInstance;function t(){return m.removeEventListener("DOMContentLoaded",document,t),m.removeEventListener("load",e,t),h()&&(r=!0),!(!s||!r)&&e.gest.start()}return d.prototype._singletonInstance=this,"complete"===document.readyState?t.call():(m.addEventListener("DOMContentLoaded",document,t),m.addEventListener("load",e,t)),!0},c=function(e){var t=m.createCustomEvent("gest",document);t.direction=e.direction||null,t.up=e.up||!1,t.down=e.down||!1,t.left=e.left||!1,t.right=e.right||!1,t.error=e.error||null,m.fireEvent(t)},h=function(){return n=document.createElement("video"),a=document.createElement("canvas"),n.canPlayType&&a.getContext&&a.getContext("2d")&&navigator.getUserMedia?(n.width=300,n.height=225,n.setAttribute("style","visibility: hidden;"),document.body.appendChild(n),a.setAttribute("style","width: 300px; display: none;"),document.body.appendChild(a),i=a.getContext("2d"),!0):(u(0),!1)},u=function(e,t){var n;switch(e){case 0:n={code:e,message:"gest.js can't run in your browser :("};break;case 1:n={code:e,message:"gest.js could not start."};break;case 2:n={code:e,message:"gest.js has already started."};break;case 10:n={code:e,message:"DEEENIED! gest.js needs webcam access.",obj:t};break;case 11:n={code:e,message:"A constraint specified is not supported by the web-browser.",obj:t};break;case 12:n={code:e,message:"No media tracks of the type specified in the constraints are found.",obj:t};break;case 13:n={code:e,message:"Couldn't get access to webcam.",obj:t};break;default:n=null}o.debug.state&&console.error(n.message),c({error:n})},v={huemin:0,huemax:.1,satmin:.3,satmax:1,valmin:.4,valmax:1,rgb2hsv:function(e,t,n){e/=255,t/=255,n/=255;var a,i,o=Math.max(e,t,n),r=Math.min(e,t,n),s=o,d=o-r;if(i=0===o?0:d/o,o==r)a=0;else{switch(o){case e:a=(t-n)/d+(tthis.huemin&&c[0].59&&c[0]<1)&&c[1]>this.satmin&&c[1]this.valmin&&c[2]=0;){Math.abs(e.data[h]-this.priorFrame.data[h])+Math.abs(e.data[h+1]-this.priorFrame.data[h+1])+Math.abs(e.data[h+2]-this.priorFrame.data[h+2])>768*Math.abs((t-100)/100)?(r.data[h]=255,r.data[h+1]=0,r.data[h+2]=0,r.data[h+3]=255,c+=1,s+=h/4%r.width,d+=Math.floor(h/4/r.height)):(r.data[h]=e.data[h],r.data[h+1]=e.data[h+1],r.data[h+2]=e.data[h+2],r.data[h+3]=e.data[h+3])}c>0&&(g.search({x:s,y:d,d:c}),o.debug.state&&o.debug.context.putImageData&&(o.debug.canvas.width=n,o.debug.canvas.height=a,o.debug.context.putImageData(r,0,0))),this.priorFrame=e}},g={prior:!1,filteringFactor:.9,filteredTotal:0,minTotalChange:300,minDirChange:2,longDirChange:7,state:0,search:function(e){var t={x:e.x/e.d,y:e.y/e.d,d:e.d};this.filteredTotal=this.filteringFactor*this.filteredTotal+(1-this.filteringFactor)*t.d;var n=t.d-this.filteredTotal>this.minTotalChange;switch(this.state){case 0:n&&(this.state=1,g.prior=t);break;case 1:this.state=2;var a=t.x-g.prior.x,i=t.y-g.prior.y,o=Math.abs(i)this.minDirChange&&o&&c({direction:"Left",left:!0}),i>this.minDirChange&&!o?Math.abs(i)>this.longDirChange?c({direction:"Long down",down:!0}):c({direction:"Down",down:!0}):i<-this.minDirChange&&!o&&(Math.abs(i)>this.longDirChange?c({direction:"Long up",up:!0}):c({direction:"Up",up:!0}));break;case 2:n||(this.state=0)}}},m={htmlEvents:{onload:1,onunload:1,onblur:1,onchange:1,onfocus:1,onreset:1,onselect:1,onsubmit:1,onabort:1,onkeydown:1,onkeypress:1,onkeyup:1,onclick:1,ondblclick:1,onmousedown:1,onmousemove:1,onmouseout:1,onmouseover:1,onmouseup:1},addEventListener:function(e,t,n){t.addEventListener?t.addEventListener(e,n,!1):t.attachEvent&&this.htmlEvents["on"+e]?t.attachEvent("on"+e,n):t["on"+e]=n},removeEventListener:function(e,t,n){t.removeEventListener?t.removeEventListener(e,n,!1):t.detachEvent&&this.htmlEvents["on"+e]?t.detachEvent("on"+e,n):t["on"+e]=null},createCustomEvent:function(e,t){try{var n;return t.createEvent?(n=t.createEvent("Event")).initEvent(e,!0,!0):t.createEventObject&&((n=t.createEventObject()).eventType=e),n.evntName=e,n.evntElement=t,n}catch(e){return console.error(e),!1}},fireEvent:function(e){try{e.evntElement.dispatchEvent?e.evntElement.dispatchEvent(e):e.evntElement.fireEvent&&this.htmlEvents["on"+e.evntName]?e.evntElement.fireEvent("on"+e.eventType,e):e.evntElement[e.evntName]?e.evntElement[e.evntName]():e.evntElement["on"+e.evntName]&&e.evntElement["on"+e.evntName]()}catch(e){console.error(e)}}};return d.prototype.start=function(){return s=!0,!!r&&(n&&(n.paused||n.ended||n.seeking||n.readyState=100?100:e<=0?0:e},debug:function(e){return o.debug.state=e,e?(o.debug.canvas=document.createElement("canvas"),o.debug.canvas.setAttribute("style","width: 100%; height: 100%; display: block; position: absolute; top: 0; left: 0;"),document.body.appendChild(o.debug.canvas),o.debug.context=o.debug.canvas.getContext("2d")):(o.debug.canvas.setAttribute("style","display: none;"),o.debug.canvas.parentNode.removeChild(o.debug.canvas)),o.debug},skinFilter:function(e){o.skinFilter=e}},new d}(window); \ No newline at end of file