!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.wechatH5Video=n():t.wechatH5Video=n()}(window,function(){return function(t){var n={};function e(i){if(n[i])return n[i].exports;var o=n[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=t,e.c=n,e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:i})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(e.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var o in t)e.d(i,o,function(n){return t[n]}.bind(null,o));return i},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="",e(e.s="tjUo")}({"9tPo":function(t,n){t.exports=function(t){var n="undefined"!=typeof window&&window.location;if(!n)throw new Error("fixUrls requires window.location");if(!t||"string"!=typeof t)return t;var e=n.protocol+"//"+n.host,i=e+n.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,function(t,n){var o,r=n.trim().replace(/^"(.*)"$/,function(t,n){return n}).replace(/^'(.*)'$/,function(t,n){return n});return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(r)?t:(o=0===r.indexOf("//")?r:0===r.indexOf("/")?e+r:i+r.replace(/^\.\//,""),"url("+JSON.stringify(o)+")")})}},FdW2:function(t,n,e){(n=t.exports=e("I1BE")(!1)).push([t.i,"._1xwULLzOHv {\n position: absolute;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n z-index: 999;\n /* display: none; */\n background-color: black;\n overflow: hidden;\n}\n\n.UXTJH12jSj {\n position: absolute;\n left: -100%;\n top: -100%;\n right: -100%;\n bottom: -100%;\n margin: auto;\n z-index: 1;\n overflow: hidden;\n background-color: black;\n transform-origin: 50% 50%;\n}\n\n.P9ADzOFtys {\n position: absolute;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n z-index: -1;\n /* object-fit: fill;\n object-position: 50% 50%; */\n}\n\n._3yeOA1YF-a {\n position: absolute;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n z-index: 10;\n}\n\n.LavftRexGF {\n width: 100%;\n height: 100%;\n position: absolute;\n background: transparent no-repeat;\n background-size: cover;\n z-index: 99;\n}\n\n.HgFlCSREpq {\n position: absolute;\n left: -100%;\n top: -100%;\n right: -100%;\n bottom: -100%;\n z-index: 1000;\n margin: auto;\n max-width: 60px;\n max-height: 60px;\n opacity: .6;\n}\n\n.HgFlCSREpq svg{\n max-width: 60px;\n max-height: 60px;\n fill: #fff;\n}\n\n._1CKERg-CKj {\n display: none;\n color: #fff;\n position: absolute;\n top: 20px;\n right: 20px;\n z-index: 1000;\n}",""]),n.locals={container:"_1xwULLzOHv",wrapper:"UXTJH12jSj",video:"P9ADzOFtys",mask:"_3yeOA1YF-a",poster:"LavftRexGF",playBtn:"HgFlCSREpq",jumpBtn:"_1CKERg-CKj"}},I1BE:function(t,n){t.exports=function(t){var n=[];return n.toString=function(){return this.map(function(n){var e=function(t,n){var e=t[1]||"",i=t[3];if(!i)return e;if(n&&"function"==typeof btoa){var o=(s=i,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(s))))+" */"),r=i.sources.map(function(t){return"/*# sourceURL="+i.sourceRoot+t+" */"});return[e].concat(r).concat([o]).join("\n")}var s;return[e].join("\n")}(n,t);return n[2]?"@media "+n[2]+"{"+e+"}":e}).join("")},n.i=function(t,e){"string"==typeof t&&(t=[[null,t,""]]);for(var i={},o=0;o=0&&p.splice(n,1)}function m(t){var n=document.createElement("style");if(void 0===t.attrs.type&&(t.attrs.type="text/css"),void 0===t.attrs.nonce){var i=function(){0;return e.nc}();i&&(t.attrs.nonce=i)}return y(n,t.attrs),f(t,n),n}function y(t,n){Object.keys(n).forEach(function(e){t.setAttribute(e,n[e])})}function w(t,n){var e,i,o,r;if(n.transform&&t.css){if(!(r="function"==typeof n.transform?n.transform(t.css):n.transform.default(t.css)))return function(){};t.css=r}if(n.singleton){var s=u++;e=c||(c=m(n)),i=x.bind(null,e,s,!1),o=x.bind(null,e,s,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(e=function(t){var n=document.createElement("link");return void 0===t.attrs.type&&(t.attrs.type="text/css"),t.attrs.rel="stylesheet",y(n,t.attrs),f(t,n),n}(n),i=function(t,n,e){var i=e.css,o=e.sourceMap,r=void 0===n.convertToAbsoluteUrls&&o;(n.convertToAbsoluteUrls||r)&&(i=l(i));o&&(i+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */");var s=new Blob([i],{type:"text/css"}),a=t.href;t.href=URL.createObjectURL(s),a&&URL.revokeObjectURL(a)}.bind(null,e,n),o=function(){v(e),e.href&&URL.revokeObjectURL(e.href)}):(e=m(n),i=function(t,n){var e=n.css,i=n.media;i&&t.setAttribute("media",i);if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}.bind(null,e),o=function(){v(e)});return i(t),function(n){if(n){if(n.css===t.css&&n.media===t.media&&n.sourceMap===t.sourceMap)return;i(t=n)}else o()}}t.exports=function(t,n){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(n=n||{}).attrs="object"==typeof n.attrs?n.attrs:{},n.singleton||"boolean"==typeof n.singleton||(n.singleton=s()),n.insertInto||(n.insertInto="head"),n.insertAt||(n.insertAt="bottom");var e=h(t,n);return d(e,n),function(t){for(var i=[],o=0;o\n '+(this.source instanceof Object?'':'')+"\n \n ",this.container.appendChild(this.wrapper),this.options.mask&&this._initMask(),this.options.poster&&this._initPoster(),this.options.playBtn&&this._initPlayBtn(),this.options.jumpBtn&&this._initeJumpBtn()},n._initMask=function(){this.mask=document.createElement("div"),this.mask.classList.add(o.a.mask),this.container.appendChild(this.mask)},n._initPoster=function(){this.poster=document.createElement("div"),this.poster.classList.add(o.a.poster),this.poster.style.backgroundImage="url('"+this.options.poster+"')",this.container.appendChild(this.poster)},n._initPlayBtn=function(){this.playBtn=document.createElement("div"),this.playBtn.classList.add(o.a.playBtn),this.playBtn.innerHTML='\n \n \n \n ',this.container.appendChild(this.playBtn)},n._initeJumpBtn=function(){this.jumpBtn=document.createElement("div"),this.jumpBtn.classList.add(o.a.jumpBtn),this.jumpBtn.innerHTML="跳过视频>>",this.container.appendChild(this.jumpBtn)},n.getVideo=function(){return this.wrapper.querySelector("."+o.a.video)},n.load=function(){return this.context.contains(this.container)||this.init(),this._addEvent(),this.video.load(),this},n.play=function(){this.video.play(),this.options.onPlay();var t=this;t.video.isPlayed=!1,t.video.addEventListener("timeupdate",function(){!t.video.isPlayed&&this.currentTime>.1&&(t.video.isPlayed=!0,t.options.canvas&&t._drawCavas(),t._hiddenPoster(),t._hiddenPlayBtn(),t._showJumpBtn())})},n.pause=function(){this.video.pause(),this._showPlayBtn(),this._hideJumpBtn(),this.options.onPause(),this.options.canvas&&l(this.timer)},n._hiddenPoster=function(){this.poster&&(this.poster.style.display="none")},n._showPoster=function(){this.poster&&(this.poster.style.display="block")},n._hiddenPlayBtn=function(){this.playBtn&&(this.playBtn.style.display="none")},n._showPlayBtn=function(){this.playBtn&&(this.playBtn.style.display="block")},n._showJumpBtn=function(){this.jumpBtn&&(this.jumpBtn.style.display="block")},n._hideJumpBtn=function(){this.jumpBtn&&(this.jumpBtn.style.display="none")},n._remove=function(){this.context.removeChild(this.container)},n._reload=function(){this.video.currentTime=0,this.pause(),this._showPoster()},n._addEvent=function(){var t=this;this.options.playBtn&&this.playBtn.addEventListener("click",function(){t.play()},!1),this.options.mask&&this.mask.addEventListener("click",function(){t.options.onEnd(),t._remove()},!1),this.options.jumpBtn&&this.jumpBtn.addEventListener("click",function(){t.options.onEnd(),t.options.autoClose?t._remove():t._reload(),t.options.canvas&&l(t.timer)},!1),this.video.addEventListener("ended",function(){t.options.onEnd(),t._showPlayBtn(),t.options.autoClose?t._remove():t._reload(),t.options.canvas&&l(t.timer)},!1),window.onresize=function(){setTimeout(function(){s(t.wrapper,{width:window.innerWidth+"px",height:window.innerHeight+"px"}),t.options.canvas&&s(t.canvas,{width:window.innerWidth+"px",height:window.innerHeight+"px"})},200)}},n._containerRect=function(){return this.container.getBoundingClientRect()},n._handleResize=function(){var t=window.innerWidth,n=window.innerHeight-16*t/9;n=Math.round(n),this.video.style.marginTop=n/2+"px"},n._fillResize=function(){var t=this,n=function(){var n=t._containerRect().width,e=t._containerRect().height;a()===t.options.orientation?(s(t.wrapper,{width:n+"px",height:e+"px",transform:""}),t.options.canvas&&s(t.canvas,{width:n+"px",height:e+"px",transform:""})):(s(t.wrapper,{width:e+"px",height:n+"px",transform:"rotate(-90deg)"}),t.options.canvas&&s(t.canvas,{width:e+"px",height:n+"px"}))};this.options.isRotate?(n(),window.addEventListener(u,function t(){window.removeEventListener(u,t),setTimeout(function(){n(),window.addEventListener(u,t,!1)},400)},!1)):s(this.wrapper,{width:this._containerRect().width+"px",height:this._containerRect().height+"px"})},n._videoToCavas=function(){this.video&&(this.canvas=document.createElement("canvas"),this.canvas.width=this._containerRect().width,this.canvas.height=this._containerRect().height,this.canvasCtx=this.canvas.getContext("2d"),this.video.parentNode.replaceChild(this.canvas,this.video))},n._drawCavas=function(){var t=this;this.canvasCtx.drawImage(this.video,0,0,this.canvas.width,this.canvas.height),this.timer=p(function(){t._drawCavas()})},t}(),s=function(t,n){for(var e in n)t.style[e]=n[e]},a=function(){return document.documentElement.clientWidth>document.documentElement.clientHeight?"landscape":"portrait"},c=function(t){return"string"==typeof t&&t.constructor===String},u="onorientationchange"in window?"orientationchange":"resize",p=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame,l=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.msCancelAnimationFrame}}).default});