/*! * artplayer-plugin-gif.js v3.1.19 * Github: https://github.com/zhw2590582/ArtPlayer#readme * (c) 2017-2019 Harvey Zack * Released under the MIT License. */ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).artplayerPluginGif=t()}(this,(function(){"use strict";var e=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e};"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function t(e,t){return e(t={exports:{}},t.exports),t.exports}var r=t((function(e,t){!function(t,r,i,n){var o,a,s={URL:t.URL||t.webkitURL||t.mozURL||t.msURL,getUserMedia:(a=i.getUserMedia||i.webkitGetUserMedia||i.mozGetUserMedia||i.msGetUserMedia,a?a.bind(i):a),requestAnimFrame:t.requestAnimationFrame||t.webkitRequestAnimationFrame||t.mozRequestAnimationFrame||t.oRequestAnimationFrame||t.msRequestAnimationFrame,requestTimeout:function(e,t){if(e=e||s.noop,t=t||0,!s.requestAnimFrame)return setTimeout(e,t);var r=(new Date).getTime(),i=new Object,n=s.requestAnimFrame;return i.value=n((function o(){(new Date).getTime()-r>=t?e.call():i.value=n(o)})),i},Blob:t.Blob||t.BlobBuilder||t.WebKitBlobBuilder||t.MozBlobBuilder||t.MSBlobBuilder,btoa:(o=t.btoa||function(e){for(var t="",r=0,i=e.length,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o=void 0,a=void 0,s=void 0,c=void 0,d=void 0,l=void 0,u=void 0;r>2,d=(3&o)<<4|(a=e.charCodeAt(r++))>>4,l=(15&a)<<2|(s=e.charCodeAt(r++))>>6,u=63&s,isNaN(a)?l=u=64:isNaN(s)&&(u=64),t=t+n.charAt(c)+n.charAt(d)+n.charAt(l)+n.charAt(u);return t},o?o.bind(t):s.noop),isObject:function(e){return e&&"[object Object]"===Object.prototype.toString.call(e)},isEmptyObject:function(e){return s.isObject(e)&&!Object.keys(e).length},isArray:function(e){return e&&Array.isArray(e)},isFunction:function(e){return e&&"function"==typeof e},isElement:function(e){return e&&1===e.nodeType},isString:function(e){return"string"==typeof e||"[object String]"===Object.prototype.toString.call(e)},isSupported:{canvas:function(){var e=r.createElement("canvas");return e&&e.getContext&&e.getContext("2d")},webworkers:function(){return t.Worker},blob:function(){return s.Blob},Uint8Array:function(){return t.Uint8Array},Uint32Array:function(){return t.Uint32Array},videoCodecs:function(){var e=r.createElement("video"),t={mp4:!1,h264:!1,ogv:!1,ogg:!1,webm:!1};try{e&&e.canPlayType&&(t.mp4=""!==e.canPlayType('video/mp4; codecs="mp4v.20.8"'),t.h264=""!==(e.canPlayType('video/mp4; codecs="avc1.42E01E"')||e.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"')),t.ogv=""!==e.canPlayType('video/ogg; codecs="theora"'),t.ogg=""!==e.canPlayType('video/ogg; codecs="theora"'),t.webm=-1!==e.canPlayType('video/webm; codecs="vp8, vorbis"'))}catch(e){}return t}()},noop:function(){},each:function(e,t){var r=void 0,i=void 0;if(s.isArray(e))for(r=-1,i=e.length;++r0&&arguments[0]!==n?arguments[0]:{};if(!r.body||!1===e.resizeFont)return e.fontSize;var t=e.text,i=e.gifWidth,o=parseInt(e.fontSize,10),a=parseInt(e.minFontSize,10),s=r.createElement("div"),c=r.createElement("span");for(s.setAttribute("width",i),s.appendChild(c),c.innerHTML=t,c.style.fontSize=o+"px",c.style.textIndent="-9999px",c.style.visibility="hidden",r.body.appendChild(c);c.offsetWidth>i&&o>=a;)c.style.fontSize=--o+"px";return r.body.removeChild(c),o+"px"},webWorkerError:!1},c=Object.freeze({default:s}),d={validate:function(e){e=s.isObject(e)?e:{};var t={};return s.each(d.validators,(function(r,i){var n=i.errorCode;if(!e[n]&&!i.condition)return(t=i).error=!0,!1})),delete t.condition,t},isValid:function(e){var t=!0!==d.validate(e).error;return t},validators:[{condition:s.isFunction(s.getUserMedia),errorCode:"getUserMedia",errorMsg:"The getUserMedia API is not supported in your browser"},{condition:s.isSupported.canvas(),errorCode:"canvas",errorMsg:"Canvas elements are not supported in your browser"},{condition:s.isSupported.webworkers(),errorCode:"webworkers",errorMsg:"The Web Workers API is not supported in your browser"},{condition:s.isFunction(s.URL),errorCode:"window.URL",errorMsg:"The window.URL API is not supported in your browser"},{condition:s.isSupported.blob(),errorCode:"window.Blob",errorMsg:"The window.Blob File API is not supported in your browser"},{condition:s.isSupported.Uint8Array(),errorCode:"window.Uint8Array",errorMsg:"The window.Uint8Array function constructor is not supported in your browser"},{condition:s.isSupported.Uint32Array(),errorCode:"window.Uint32Array",errorMsg:"The window.Uint32Array function constructor is not supported in your browser"}],messages:{videoCodecs:{errorCode:"videocodec",errorMsg:"The video codec you are trying to use is not supported in your browser"}}},l=Object.freeze({default:d}),u=function(){},f={sampleInterval:10,numWorkers:2,filter:"",gifWidth:200,gifHeight:200,interval:.1,numFrames:10,frameDuration:1,keepCameraOn:!1,images:[],video:null,webcamVideoElement:null,cameraStream:null,text:"",fontWeight:"normal",fontSize:"16px",minFontSize:"10px",resizeFont:!1,fontFamily:"sans-serif",fontColor:"#ffffff",textAlign:"center",textBaseline:"bottom",textXCoordinate:null,textYCoordinate:null,progressCallback:u,completeCallback:u,saveRenderingContexts:!1,savedRenderingContexts:[],crossOrigin:"Anonymous"},g=Object.freeze({default:f});function m(){return d.isValid()}function h(){var e,t,r,i,n,o=256,a=499,s=491,c=487,d=503,l=3*d,u=o-1,f=4,g=100,m=16,h=1<>v,w=h<>3)*(1<o&&(l=o),s=t+1,c=t-1,f=1;sd;){if(u=A[f++],sd){g=n[c--];try{g[0]-=u*(g[0]-r)/O|0,g[1]-=u*(g[1]-i)/O|0,g[2]-=u*(g[2]-a)/O|0}catch(e){}}}}function T(e,t,r,i,o){var a=n[t],s=e/x;a[0]-=s*(a[0]-r)|0,a[1]-=s*(a[1]-i)|0,a[2]-=s*(a[2]-o)|0}function U(e,t,r){var i,a,s,c,d,l,u,g,h,y;for(h=g=~(1<<31),u=l=-1,i=0;i>m-f))>v,E[i]-=d,W[i]+=d<=0;)i=d?i=o:(i++,s<0&&(s=-s),(c=l[0]-e)<0&&(c=-c),(s+=c)=0&&((s=t-(l=n[a])[1])>=d?a=-1:(a--,s<0&&(s=-s),(c=l[0]-e)<0&&(c=-c),(s+=c)>y)<=1&&(v=0),n=0;n=M&&(E-=r),0===O&&(O=1),++n%O==0)for(b-=b/e,(v=(p-=p/S)>>y)<=1&&(v=0),o=0;o>=f,n[e][1]>>=f,n[e][2]>>=f,n[e][3]=e}(),function(){var e,t,r,i,a,s,c,d;for(c=0,d=0,e=0;e>1,t=c+1;t>1,t=c+1;t<256;t++)F[t]=u}(),function(){for(var e=[],t=new Array(o),r=0;r65535||r>65535)throw"Width/Height invalid.";e[o++]=71,e[o++]=73,e[o++]=70,e[o++]=56,e[o++]=57,e[o++]=97;if(e[o++]=255&t,e[o++]=t>>8&255,e[o++]=255&r,e[o++]=r>>8&255,e[o++]=0|(null!==s?128:0),e[o++]=0,e[o++]=0,null!==a){if(a<0||a>65535)throw"Loop count invalid.";e[o++]=33,e[o++]=255,e[o++]=11,e[o++]=78,e[o++]=69,e[o++]=84,e[o++]=83,e[o++]=67,e[o++]=65,e[o++]=80,e[o++]=69,e[o++]=50,e[o++]=46,e[o++]=48,e[o++]=3,e[o++]=1,e[o++]=255&a,e[o++]=a>>8&255,e[o++]=0}var c=!1;this.addFrame=function(t,r,i,a,d,l){if(!0===c&&(--o,c=!1),l=l===n?{}:l,t<0||r<0||t>65535||r>65535)throw"x/y invalid.";if(i<=0||a<=0||i>65535||a>65535)throw"Width/Height invalid.";if(d.length256||t&t-1)throw"Invalid code/color length, must be power of 2 and 2 .. 256.";return t}(f),m=0;g>>=1;)++m;g=1<3)throw"Disposal out of range.";var v=!1,b=0;if(l.transparent!==n&&null!==l.transparent&&(v=!0,(b=l.transparent)<0||b>=g))throw"Transparent color index.";if((0!==p||v||0!==h)&&(e[o++]=33,e[o++]=249,e[o++]=4,e[o++]=p<<2|(!0===v?1:0),e[o++]=255&h,e[o++]=h>>8&255,e[o++]=b,e[o++]=0),e[o++]=44,e[o++]=255&t,e[o++]=t>>8&255,e[o++]=255&r,e[o++]=r>>8&255,e[o++]=255&i,e[o++]=i>>8&255,e[o++]=255&a,e[o++]=a>>8&255,e[o++]=!0===u?128|m-1:0,!0===u)for(var w=0,y=f.length;w>16&255,e[o++]=C>>8&255,e[o++]=255&C}o=function(e,t,r,i){e[t++]=r;var o=t++,a=1<=r;)e[t++]=255&f,f>>=8,u-=8,t===o+256&&(e[o]=255,o=t++)}function m(e){f|=e<=8;)e[t++]=255&f,f>>=8,u-=8,t===o+256&&(e[o]=255,o=t++);4096===d?(m(a),d=c+1,l=r+1,p={}):(d>=1<0&&arguments[0]!==n?arguments[0]:{},r=e.data;delete s.data,s.pixels=Array.prototype.slice.call(r.pixels),s.palette=Array.prototype.slice.call(r.palette),s.done=!0,s.beingProcessed=!1,t.freeWorker(c),t.onFrameFinished(i)};(s=a[e]).beingProcessed||s.done?this.onFrameFinished():(s.sampleInterval=o,s.beingProcessed=!0,s.gifshot=!0,(c=this.getWorker())?(c.onmessage=d,c.postMessage(s)):d({data:t.workerMethods.run(s)}))},startRendering:function(e){this.onRenderCompleteCallback=e;for(var t=0;t=0&&this.processFrame(e)},generateGIF:function(e,t){var r=[],i={loop:this.repeat},n=this.options,o=n.interval,a=n.frameDuration,c=!!n.images.length,d=n.gifHeight,l=n.gifWidth,u=new v(r,l,d,i),f=this.onRenderProgressCallback,g=c?100*o:0,m=void 0;this.generatingGIF=!0,s.each(e,(function(t,r){var i=r.palette;f(.75+.25*r.position*1/e.length);for(var n=0;n0&&arguments[0]!==n?arguments[0]:{},t=this.frames,r=e.data;this.frames.push({data:r,width:e.width,height:e.height,palette:null,dithering:null,done:!1,beingProcessed:!1,position:t.length})},onRenderProgress:function(e){this.onRenderProgressCallback=e},isRendering:function(){return this.generatingGIF},getBase64GIF:function(e){var t=this;t.startRendering((function(r){t.destroyWorkers(),s.requestTimeout((function(){e(r)}),0)}))},destroyWorkers:function(){if(!this.workerError){var e=this.workers;s.each(e,(function(e,t){var r=t.worker,i=t.objectUrl;r.terminate(),s.URL.revokeObjectURL(i)}))}}};var y=function(){},C={getGIF:function(){var e=arguments.length>0&&arguments[0]!==n?arguments[0]:{},t=arguments[1];t=s.isFunction(t)?t:y;var i=r.createElement("canvas"),o=void 0,a=e.images,c=!!a.length,d=e.cameraStream,l=e.crop,u=e.filter,f=e.fontColor,g=e.fontFamily,m=e.fontWeight,h=e.keepCameraOn,p=(e.numWorkers,e.progressCallback),v=e.saveRenderingContexts,b=e.savedRenderingContexts,C=e.text,S=e.textAlign,x=e.textBaseline,k=e.videoElement,O=e.videoHeight,F=e.videoWidth,W=e.webcamVideoElement,E=Number(e.gifWidth),A=Number(e.gifHeight),R=Number(e.interval),T=(Number(e.sampleInterval),c?0:1e3*R),U=[],M=b.length?b.length:e.numFrames,j=M,I=new w(e),P=s.getFontSize(e),V=e.textXCoordinate?e.textXCoordinate:"left"===S?1:"right"===S?E:E/2,L=e.textYCoordinate?e.textYCoordinate:"top"===x?1:"center"===x?A/2:A,H=m+" "+P+" "+g,z=l?Math.floor(l.scaledWidth/2):0,G=l?F-l.scaledWidth:0,B=l?Math.floor(l.scaledHeight/2):0,D=l?O-l.scaledHeight:0,N=function e(){var r=j-1;function i(){var i;v&&U.push(o.getImageData(0,0,E,A)),C&&(o.font=H,o.fillStyle=f,o.textAlign=S,o.textBaseline=x,o.fillText(C,V,L)),i=o.getImageData(0,0,E,A),I.addFrameImageData(i),p((M-(j=r))/M),r>0&&s.requestTimeout(e,T),j||I.getBase64GIF((function(e){t({error:!1,errorCode:"",errorMsg:"",image:e,cameraStream:d,videoElement:k,webcamVideoElement:W,savedRenderingContexts:U,keepCameraOn:h})}))}b.length?(o.putImageData(b[M-j],0,0),i()):function e(){try{G>F&&(G=F),D>O&&(D=O),z<0&&(z=0),B<0&&(B=0),o.filter=u,o.drawImage(k,z,B,G,D,0,0,E,A),i()}catch(t){if("NS_ERROR_NOT_AVAILABLE"!==t.name)throw t;s.requestTimeout(e,100)}}()};M=M!==n?M:10,R=R!==n?R:.1,i.width=E,i.height=A,o=i.getContext("2d"),function e(){b.length||0!==k.currentTime?N():s.requestTimeout(e,100)}()},getCropDimensions:function(){var e=arguments.length>0&&arguments[0]!==n?arguments[0]:{},t=e.videoWidth,r=e.videoHeight,i=e.gifWidth,o=e.gifHeight,a={width:0,height:0,scaledWidth:0,scaledHeight:0};return t>r?(a.width=Math.round(t*(o/r))-i,a.scaledWidth=Math.round(a.width*(r/o))):(a.height=Math.round(r*(i/t))-o,a.scaledHeight=Math.round(a.height*(t/i))),a}},S={loadedData:!1,defaultVideoDimensions:{width:640,height:480},findVideoSize:function e(t){e.attempts=e.attempts||0;var r=t.cameraStream,i=t.completedCallback,n=t.videoElement;n&&(n.videoWidth>0&&n.videoHeight>0?(n.removeEventListener("loadeddata",S.findVideoSize),i({videoElement:n,cameraStream:r,videoWidth:n.videoWidth,videoHeight:n.videoHeight})):e.attempts<10?(e.attempts+=1,s.requestTimeout((function(){S.findVideoSize(t)}),400)):i({videoElement:n,cameraStream:r,videoWidth:S.defaultVideoDimensions.width,videoHeight:S.defaultVideoDimensions.height}))},onStreamingTimeout:function(e){s.isFunction(e)&&e({error:!0,errorCode:"getUserMedia",errorMsg:"There was an issue with the getUserMedia API - Timed out while trying to start streaming",image:null,cameraStream:{}})},stream:function(e){var t=s.isArray(e.existingVideo)?e.existingVideo[0]:e.existingVideo,r=e.cameraStream,i=e.completedCallback,n=e.streamedCallback,o=e.videoElement;if(s.isFunction(n)&&n(),t){if(s.isString(t))o.src=t,o.innerHTML='';else if(t instanceof Blob){try{o.src=s.URL.createObjectURL(t)}catch(e){}o.innerHTML=''}}else if(o.mozSrcObject)o.mozSrcObject=r;else if(s.URL)try{o.srcObject=r,o.src=s.URL.createObjectURL(r)}catch(e){o.srcObject=r}o.play(),s.requestTimeout((function e(){e.count=e.count||0,!0===S.loadedData?(S.findVideoSize({videoElement:o,cameraStream:r,completedCallback:i}),S.loadedData=!1):(e.count+=1)>10?S.findVideoSize({videoElement:o,cameraStream:r,completedCallback:i}):e()}),0)},startStreaming:function(e){var t=s.isFunction(e.error)?e.error:s.noop,i=s.isFunction(e.streamed)?e.streamed:s.noop,n=s.isFunction(e.completed)?e.completed:s.noop,o=e.crossOrigin,a=e.existingVideo,c=e.lastCameraStream,d=e.options,l=e.webcamVideoElement,u=s.isElement(a)?a:l||r.createElement("video");o&&(u.crossOrigin=d.crossOrigin),u.autoplay=!0,u.loop=!0,u.muted=!0,u.addEventListener("loadeddata",(function(e){S.loadedData=!0,d.offset&&(u.currentTime=d.offset)})),a?S.stream({videoElement:u,existingVideo:a,completedCallback:n}):c?S.stream({videoElement:u,cameraStream:c,streamedCallback:i,completedCallback:n}):s.getUserMedia({video:!0},(function(e){S.stream({videoElement:u,cameraStream:e,streamedCallback:i,completedCallback:n})}),t)},startVideoStreaming:function(e){var t=arguments.length>1&&arguments[1]!==n?arguments[1]:{},r=t.timeout!==n?t.timeout:0,i=t.callback,o=t.webcamVideoElement,a=void 0;r>0&&(a=s.requestTimeout((function(){S.onStreamingTimeout(i)}),1e4)),S.startStreaming({error:function(){i({error:!0,errorCode:"getUserMedia",errorMsg:"There was an issue with the getUserMedia API - the user probably denied permission",image:null,cameraStream:{}})},streamed:function(){clearTimeout(a)},completed:function(){var t=arguments.length>0&&arguments[0]!==n?arguments[0]:{},r=t.cameraStream,i=t.videoElement,o=t.videoHeight,a=t.videoWidth;e({cameraStream:r,videoElement:i,videoHeight:o,videoWidth:a})},lastCameraStream:t.lastCameraStream,webcamVideoElement:o,crossOrigin:t.crossOrigin,options:t})},stopVideoStreaming:function(e){var t=e=s.isObject(e)?e:{},r=t.keepCameraOn,i=t.videoElement,n=t.webcamVideoElement,o=e.cameraStream||{},a=o.getTracks&&o.getTracks()||[],c=!!a.length,d=a[0];!r&&c&&s.isFunction(d.stop)&&d.stop(),s.isElement(i)&&!n&&(i.pause(),s.isFunction(s.URL.revokeObjectURL)&&!s.webWorkerError&&i.src&&s.URL.revokeObjectURL(i.src),s.removeElement(i))}};function x(e){e=s.isObject(e)?e:{},S.stopVideoStreaming(e)}function k(e,t){var i=e.options||{},n=i.images,o=i.video,a=Number(i.gifWidth),c=Number(i.gifHeight),d=(Number(i.numFrames),e.cameraStream),l=e.videoElement,u=e.videoWidth,f=e.videoHeight,g=C.getCropDimensions({videoWidth:u,videoHeight:f,gifHeight:c,gifWidth:a}),m=t;i.crop=g,i.videoElement=l,i.videoWidth=u,i.videoHeight=f,i.cameraStream=d,s.isElement(l)&&(l.width=a+g.width,l.height=c+g.height,i.webcamVideoElement||(s.setCSSAttr(l,{position:"fixed",opacity:"0"}),r.body.appendChild(l)),l.play(),C.getGIF(i,(function(e){n&&n.length||o&&o.length||x(e),m(e)})))}function O(e,t){if(t=s.isFunction(e)?e:t,e=s.isObject(e)?e:{},s.isFunction(t)){var i=s.mergeOptions(f,e)||{},o=e.cameraStream,a=i.images,c=a?a.length:0,l=i.video,u=i.webcamVideoElement;i=s.mergeOptions(i,{gifWidth:Math.floor(i.gifWidth),gifHeight:Math.floor(i.gifHeight)}),c?function(){var e=arguments.length>0&&arguments[0]!==n?arguments[0]:{},t=e.callback,i=e.images,o=e.options,a=e.imagesLength,c=d.validate({getUserMedia:!0,"window.URL":!0}),l=[],u=0,f=void 0,g=void 0;if(c.error)return t(c);function m(){s.each(l,(function(e,t){t&&(t.text?g.addFrame(t.img,o,t.text):g.addFrame(t,o))})),function(e,t){e.getBase64GIF((function(e){t({error:!1,errorCode:"",errorMsg:"",image:e})}))}(g,t)}g=new w(o),s.each(i,(function(e,i){var n=i;i.src&&(n=n.src),s.isElement(n)?(o.crossOrigin&&(n.crossOrigin=o.crossOrigin),l[e]=n,(u+=1)===a&&m()):s.isString(n)&&(f=new Image,o.crossOrigin&&(f.crossOrigin=o.crossOrigin),function(r){i.text&&(r.text=i.text),r.onerror=function(e){var r=void 0;if(0===--a)return(r={}).error="None of the requested images was capable of being retrieved",t(r)},r.onload=function(t){i.text?l[e]={img:r,text:r.text}:l[e]=r,(u+=1)===a&&m(),s.removeElement(r)},r.src=n}(f),s.setCSSAttr(f,{position:"fixed",opacity:"0"}),r.body.appendChild(f))}))}({images:a,imagesLength:c,callback:t,options:i}):l?function(){var e=arguments.length>0&&arguments[0]!==n?arguments[0]:{},t=e.callback,r=e.existingVideo,i=e.options,o=d.validate({getUserMedia:!0,"window.URL":!0}),a=void 0,c=void 0;if(o.error)return t(o);if(s.isElement(r)&&r.src){if(c=r.src,a=s.getExtension(c),!s.isSupported.videoCodecs[a])return t(d.messages.videoCodecs)}else s.isArray(r)&&s.each(r,(function(e,t){if(a=t instanceof Blob?t.type.substr(t.type.lastIndexOf("/")+1,t.length):t.substr(t.lastIndexOf(".")+1,t.length),s.isSupported.videoCodecs[a])return r=t,!1}));S.startStreaming({completed:function(e){e.options=i||{},k(e,t)},existingVideo:r,crossOrigin:i.crossOrigin,options:i})}({existingVideo:l,callback:t,options:i}):function(){var e=arguments.length>0&&arguments[0]!==n?arguments[0]:{},t=e.callback,r=e.lastCameraStream,i=e.options,o=e.webcamVideoElement;if(!m())return t(d.validate());i.savedRenderingContexts.length?C.getGIF(i,(function(e){t(e)})):S.startVideoStreaming((function(){var e=arguments.length>0&&arguments[0]!==n?arguments[0]:{};e.options=i||{},k(e,t)}),{lastCameraStream:r,callback:t,webcamVideoElement:o,crossOrigin:i.crossOrigin})}({lastCameraStream:o,callback:t,webcamVideoElement:u,options:i})}}var F={utils:c,error:l,defaultOptions:g,createGIF:O,takeSnapShot:function(e,t){if(t=s.isFunction(e)?e:t,e=s.isObject(e)?e:{},s.isFunction(t)){var r=s.mergeOptions(f,e);O(s.mergeOptions(r,{interval:.1,numFrames:1,gifWidth:Math.floor(r.gifWidth),gifHeight:Math.floor(r.gifHeight)}),t)}},stopVideoStreaming:x,isSupported:function(){return d.isValid()},isWebCamGIFSupported:m,isExistingVideoGIFSupported:function(e){var t=!1;if(s.isArray(e)&&e.length){if(s.each(e,(function(e,r){s.isSupported.videoCodecs[r]&&(t=!0)})),!t)return!1}else if(s.isString(e)&&e.length&&!s.isSupported.videoCodecs[e])return!1;return d.isValid({getUserMedia:!0})},isExistingImagesGIFSupported:function(){return d.isValid({getUserMedia:!0})},VERSION:"0.4.5"};"function"==typeof n&&n.amd?n([],(function(){return F})):e.exports=F}("undefined"!=typeof window?window:{},"undefined"!=typeof document?document:{createElement:function(){}},"undefined"!=typeof window?window.navigator:{})})),i=t((function(e){var t;t=function(){return function(e,t,r){t=t||"",r=r||512;for(var i=atob(e),n=[],o=0;o0&&void 0!==arguments[0]?arguments[0]:{},a=arguments.length>1?arguments[1]:void 0;y=!0,f.show=!0,e.emit("artplayerPluginGif:start"),d.show(c.get("Start creating gif..."),!1),r.createGIF(o({},t,{video:[v.src],crossOrigin:"anonymous"}),(function(t){if(t.error)d.show(t.errorMsg),n(!1,t.errorMsg);else if("function"==typeof a){var r=t.image.split(",")[1],o=i(r,"image/gif"),s=URL.createObjectURL(o);d.show(c.get("Create gif successfully")),e.emit("artplayerPluginGif",s),a(s)}y=!1,f.show=!1,e.emit("artplayerPluginGif:end")}))}}}}));