(("undefined"!=typeof self?self:this).webpackJsonp__wix_instagram_business=("undefined"!=typeof self?self:this).webpackJsonp__wix_instagram_business||[]).push([[65],{1015:function(e,t,i){"use strict";e.exports=function(e,t){var i="calc(100% + 1px)";return e?{height:t?i:"auto",width:t?"auto":i,position:"absolute",margin:"auto",minHeight:"100%",minWidth:"100%",left:"-100%",right:"-100%",top:"-100%",bottom:"-100%"}:{width:t?i:"auto",height:t?"100%":i}}},1049:function(e,t,i){"use strict";i.r(t);var o=i(1),s=i(0),a=i.n(s),n=i(15),r=i(25),p=i(9),d=i(82),l=i(1015),h=i.n(l),u=function(e){function t(t){var i=e.call(this,t)||this;return i.pause=i.pause.bind(i),i.play=i.play.bind(i),i.playVideoIfNeeded=i.playVideoIfNeeded.bind(i),i.state={playedOnce:!1,loadVideo:t.loadVideo||t.shouldPlay,isPlaying:!1,shouldPlay:t.shouldPlay,reactPlayerLoaded:!1,vimeoPlayerLoaded:!1,hlsPlayerLoaded:!1},i}return Object(o.__extends)(t,e),t.prototype.componentDidMount=function(){this.dynamiclyImportVideoPlayers()},t.prototype.dynamiclyImportVideoPlayers=function(){var e=this;n.a&&n.a.ReactPlayer||i.e(63).then(i.t.bind(null,1016,7)).then((function(t){n.a.ReactPlayer=t.default,e.setState({reactPlayerLoaded:!0}),e.playVideoIfNeeded()})),n.a&&n.a.Vimeo||!this.props.videoUrl||!this.props.videoUrl.includes("vimeo.com")||i.e(67).then(i.bind(null,1022)).then((function(t){n.a.Vimeo={Player:t.default},e.setState({vimeoPlayerLoaded:!0}),e.playVideoIfNeeded()})),n.a&&n.a.Hls||!this.isHLSVideo()||i.e(62).then(i.bind(null,1023)).then((function(t){n.a.Hls=t.default,e.setState({hlsPlayerLoaded:!0}),e.playVideoIfNeeded()}))},t.prototype.isHLSVideo=function(){return this.props.videoUrl&&(this.props.videoUrl.includes("/hls")||this.props.videoUrl.includes(".m3u8"))},t.prototype.shouldUseHlsPlayer=function(){return this.isHLSVideo()&&!r.a.isiOS()},t.prototype.shouldForceVideoForHLS=function(){return this.isHLSVideo()&&r.a.isiOS()},t.prototype.UNSAFE_componentWillReceiveProps=function(e){(e.shouldPlay||e.firstUserInteractionExecuted)&&this.setState({loadVideo:!0}),e.shouldPlay&&this.setState({shouldPlay:!0}),this.playVideoIfNeeded(e)},t.prototype.componentDidUpdate=function(e){e.activeIndex!==this.props.activeIndex&&this.fixIFrameTabIndexIfNeeded(),"image"===e.type&&"video"===this.props.type&&this.dynamiclyImportVideoPlayers(),this.playVideoIfNeeded()},t.prototype.play=function(){this.props.playVideo(this.props.idx)},t.prototype.pause=function(){this.props.pauseVideo()},t.prototype.playVideoIfNeeded=function(e){void 0===e&&(e=this.props);try{e.playingVideoIdx!==this.props.idx||this.isPlaying||(this.videoElement=this.videoElement||n.a.document.querySelector("#video-"+this.props.id+" video"),this.videoElement&&(this.isPlaying=!0,this.videoElement.play(),r.a.isVerbose()&&console.log("[VIDEO] Playing video #"+this.props.idx,this.videoElement)))}catch(e){console.error("[VIDEO] Could not play video #"+this.props.idx,this.videoElement,e)}},t.prototype.createPlayerElement=function(){var e=this;if(!n.a||!n.a.ReactPlayer||!this.state.loadVideo&&!this.props.playing)return null;var t=n.a.ReactPlayer,i=this.props.style.ratio>=this.props.cropRatio,s=this.props.options.cubeImages&&"fill"===this.props.options.cubeType,r=this.props.videoUrl?this.props.videoUrl:this.props.createUrl(p.a.urlSizes.RESIZED,p.a.urlTypes.VIDEO),l={controlsList:"nodownload",disablePictureInPicture:"true",muted:!this.props.options.videoSound,preload:"metadata",style:h()(s,i),type:"video/mp4"};return Object(d.c)(this.props.options)&&(l.poster=this.props.createUrl(p.a.urlSizes.SCALED,p.a.urlTypes.HIGH_RES)),a.a.createElement(t,{playsinline:!0,className:"gallery-item-visible video gallery-item",id:"video-"+this.props.id,width:"100%",height:"100%",url:r,alt:"string"==typeof this.props.alt?this.props.alt:"untitled video",loop:!!this.props.options.videoLoop,ref:function(t){return e.video=t},volume:this.props.options.videoSound?.8:0,playing:this.state.shouldPlay,onEnded:function(){e.setState({isPlaying:!1}),e.props.actions.eventsListener(p.a.events.VIDEO_ENDED,e.props)},onPause:function(){e.setState({isPlaying:!1})},onError:function(t){e.props.actions.eventsListener(p.a.events.VIDEO_ERROR,Object(o.__assign)(Object(o.__assign)({},e.props),{videoError:t}))},playbackRate:Number(this.props.options.videoSpeed)||1,onStart:function(){e.state.playedOnce||e.setState({playedOnce:!0})},onPlay:function(){e.props.actions.eventsListener(p.a.events.VIDEO_PLAYED,e.props),e.setState({isPlaying:!0})},onReady:function(){e.playVideoIfNeeded(),e.fixIFrameTabIndexIfNeeded(),e.props.actions.setItemLoaded(),e.setState({ready:!0})},onProgress:function(){e.props.shouldPlay||e.setState({shouldPlay:!1})},controls:this.props.options.showVideoControls,config:{file:{attributes:l,forceHLS:this.shouldUseHlsPlayer(),forceVideo:this.shouldForceVideoForHLS()}},key:"video-"+this.props.id})},t.prototype.fixIFrameTabIndexIfNeeded=function(){if(this.props.isExternalVideo){var e=n.a.document&&n.a.document.getElementById("video-"+this.props.id),t=e&&e.getElementsByTagName("iframe"),i=t&&t[0];i&&(this.props.activeIndex===this.props.idx?i.setAttribute("tabIndex","0"):i.setAttribute("tabIndex","-1"))}},t.prototype.getVideoContainerStyles=function(){var e=Object(o.__assign)({},this.props.imageDimensions);return r.a.deviceHasMemoryIssues()||this.state.ready||!Object(d.c)(this.props.options)||(e.backgroundImage="url("+this.props.createUrl(p.a.urlSizes.RESIZED,p.a.urlTypes.HIGH_RES)+")"),e},t.prototype.render=function(){var e=this.props,t=e.videoPlaceholder,i=e.hover,o=["gallery-item-content","gallery-item-visible","gallery-item-preloaded","gallery-item-video","gallery-item","video-item"];r.a.isiPhone()&&o.push("ios"),this.state.isPlaying&&o.push("playing"),this.state.playedOnce&&this.state.ready&&o.push("playedOnce"),this.props.isCurrentHover?o.push("item-content-hover"):o.push("item-content-regular");var s=a.a.createElement("div",{className:o.join(" "),"data-hook":"video_container-video-player-element",key:"video_container-"+this.props.id,style:this.getVideoContainerStyles()},this.createPlayerElement(),this.props.videoPlayButton);return a.a.createElement("div",{key:"video-and-hover-container"+this.props.idx},s,Object(d.c)(this.props.options)&&t,i)},t}(a.a.Component);t.default=u}}]); //# sourceMappingURL=vendors~proGallery_videoItem.chunk.min.js.map