1"use strict";(self.webpackChunkfrontend=self.webpackChunkfrontend||[]).push([[8715],{8715:function(e,t,a){a.r(t),a.d(t,{dyte_livestream_player:function(){return v}});var i=a(4165),n=a(5861),r=a(5671),o=a(3144),s=a(2304),l=a(5855),d=a(7622),c=(a(4130),a(5231)),u=a(1723),v=function(){function e(t){var a=this;(0,r.Z)(this,e),(0,s.r)(this,t),this.dyteAPIError=(0,s.c)(this,"dyteAPIError",7),this.showLatencyIndicator=!1,this.LoadPlayer=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:a.ivsPlayer;a.player&&e&&(e.attachHTMLVideoElement(a.player),e.setAutoplay(!0),e.setVolume(1))},this.livestreamUpdateListener=function(e){var t,i;a.livestreamState=e,"LIVESTREAMING"===e?(a.LoadPlayer(),a.getPlaybackUrl(),(null===(i=null===(t=a.meeting.__internals__)||void 0===t?void 0:t.browserSpecs)||void 0===i?void 0:i.isIOSMobile())||(a.fetchLatency(),a.updateLatency=setInterval(a.fetchLatency,2e3)),u.s.enableSource("livestream-player")):(a.showLatencyIndicator=!1,a.updateLatency&&clearInterval(a.updateLatency),u.s.disableSource("livestream-player"))},this.getLoadingState=function(){var e="",t=!1,i=!1;switch(a.livestreamState){case"IDLE":e=a.t("Waiting to go live."),t=!0,i=!1;break;case"STARTING":e=a.t("Livestream is starting..."),t=!0,i=!0;break;case"STOPPING":e=a.t("Livestream is stopping..."),t=!0,i=!0;break;case"LIVESTREAMING":a.playerState!==c.P.PLAYING&&(e=a.t("Livestream is starting..."),i=!0,t=!0);break;default:t=!1,e=a.t(""),i=!0}return{isLoading:t,loadingMessage:e,showIcon:i}},this.getErrorState=function(){var e,t,i=!1,n="";return"LIVESTREAMING"!==a.livestreamState?{isError:i=!1,errorMessage:n=a.t("")}:(a.isSupported||(i=!0,n=a.t("Player not supported.")),a.playbackUrl||(i=!0,n=a.t("Playback URL not found.")),a.playerError&&(i=!0,n=a.t(null!==(t=null===(e=a.playerError)||void 0===e?void 0:e.message)&&void 0!==t?t:"An unknown error occured.")),{isError:i,errorMessage:n})},this.fetchLatency=function(){a.ivsPlayer&&(a.latency=a.ivsPlayer.getLiveLatency())},this.stopRebuffer=function(e){a.ivsPlayer.setRebufferToLive(!1),a.latency=e,clearInterval(a.updateLatency),a.updateLatency=setInterval(a.fetchLatency,2e3)},this.resetSyncLivestream=function(){var e=a.ivsPlayer.getLiveLatency();a.stopRebuffer(e),a.dyteAPIError.emit({trace:a.t("livestreamPlayer.rebuffer.error"),message:a.t("Could not sync livestream please try again later.")})},this.syncLiveStream=function(){clearInterval(a.updateLatency),a.latency=-1,a.ivsPlayer.setRebufferToLive(!0);var e=setTimeout(a.resetSyncLivestream,15e3);a.updateLatency=setInterval((function(){var t=a.ivsPlayer.getLiveLatency();t<10&&(a.stopRebuffer(t),clearTimeout(e))}),1e3)},this.meeting=void 0,this.size=void 0,this.t=(0,d.u)(),this.iconPack=l.d,this.playbackUrl=void 0,this.isSupported=!0,this.playerState=c.P.IDLE,this.livestreamState="IDLE",this.playerError=void 0,this.latency=0,this.audioPlaybackError=!1}return(0,o.Z)(e,[{key:"AddPlayerListeners",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.ivsPlayer;Object.values(Object.assign(Object.assign({}
1,c.d),c.P)).forEach((function(a){c.e.includes(a)||null===t||void 0===t||t.addEventListener(a,(function(i){var n,r,o;a!==c.P.IDLE&&a!==c.P.PLAYING&&a!==c.d.ERROR&&a!==c.P.READY||(e.playerState=a),a===c.d.ERROR&&(e.playerError=i),a===c.P.IDLE&&t.isPaused()&&t.play(),a===c.d.AUDIO_BLOCKED&&(e.audioPlaybackError=!0),e.playerState!==c.P.PLAYING||(null===(r=null===(n=e.meeting.__internals__)||void 0===n?void 0:n.browserSpecs)||void 0===r?void 0:r.isIOSMobile())?e.showLatencyIndicator=!1:e.showLatencyIndicator=!0,e.meeting.__internals__.logger.info("IVS.Player.".concat(a),i),c.f.includes(a)&&(null===(o=e.meeting.__internals__.callStats)||void 0===o||o.ivsPlayerEvent(a,i))}))}))}},{key:"getPlaybackUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.ivsPlayer;this.playbackUrl=this.meeting.livestream.playbackUrl,this.playbackUrl&&e&&(e.load(this.playbackUrl),e.play())}},{key:"onPlayerRef",value:function(e){this.player=e,u.s.addSource("livestream-player",this.player,!!this.playbackUrl),this.playbackUrl&&u.s.enableSource("livestream-player")}},{key:"connectedCallback",value:function(){var e=this;this.meetingChanged(this.meeting),window.onDyteLivestreamPlayer=function(t){t?(e.isSupported=!0,e.ivsPlayer=t,e.AddPlayerListeners(t),e.LoadPlayer(t),e.getPlaybackUrl(t)):e.isSupported=!1},this.sendLatencyToCallStats=setInterval((function(){var t;e.fetchLatency(),null===(t=e.meeting.__internals__.callStats)||void 0===t||t.livestreamLatency(e.latency)}),1e4)}},{key:"disconnectedCallback",value:function(){window.onDyteLivestreamPlayer=void 0,this.meeting.livestream.removeListener("livestreamUpdate",this.livestreamUpdateListener),clearInterval(this.sendLatencyToCallStats),this.ivsPlayer.load(""),this.ivsPlayer=void 0,this.player=void 0}},{key:"componentDidLoad",value:function(){var e=(0,n.Z)((0,i.Z)().mark((function e(){var t;return(0,i.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:"\n import IVSPlayer from 'https://cdn.jsdelivr.net/npm/[email protected]/+esm'\n let player = undefined;\n if (IVSPlayer.isPlayerSupported) {\n player = IVSPlayer.create({\n wasmBinary:\n 'https://unpkg.com/[email protected]/dist/assets/amazon-ivs-wasmworker.min.wasm',\n wasmWorker:\n 'https://unpkg.com/[email protected]/dist/assets/amazon-ivs-wasmworker.min.js',\n });\n }\n window.onDyteLivestreamPlayer && window.onDyteLivestreamPlayer(player);\n ",(t=document.createElement("script")).type="module",t.innerHTML="\n import IVSPlayer from 'https://cdn.jsdelivr.net/npm/[email protected]/+esm'\n let player = undefined;\n if (IVSPlayer.isPlayerSupported) {\n player = IVSPlayer.create({\n wasmBinary:\n 'https://unpkg.com/[email protected]/dist/assets/amazon-ivs-wasmworker.min.wasm',\n wasmWorker:\n 'https://unpkg.com/[email protected]/dist/assets/amazon-ivs-wasmworker.min.js',\n });\n }\n window.onDyteLivestreamPlayer && window.onDyteLivestreamPlayer(player);\n ",document.body.appendChild(t);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()},{key:"meetingChanged",value:function(e){null!=e&&(this.livestreamState=this.meeting.livestream.state,"LIVESTREAMING"===this.livestreamState&&(this.LoadPlayer(),this.getPlaybackUrl(),u.s.enableSource("livestream-player")),this.meeting.livestream.on("livestreamUpdate",this.livestreamUpdateListener))}},{key:"render",value:function(){var e=this;if((0,c.s)(this.meeting)){var t=this.getErrorState(),a=t.isError,i=t.errorMessage,n=this.getLoadingState(),r=n.isLoading,o=n.loadingMessage,l=n.showIcon;return(0,s.h)(s.H,null,(0,s.h)("div",{class:"player-container"},(0,s.h)("video",{ref:function(t){return e.onPlayerRef(t)},playsInline:!0}),this.audioPlaybackError&&(0,s.h)("div",{class:"unmute-popup"},(0,s.h)("h3",null,this.t("audio_playback.title")),(0,s.h)("p",null,this.t("audio_playback.description")),(0,s.h)("dyte-button",{kind:"wide",onClick:function(){e.player.muted=!1,e.audioPlaybackError=!1},title:this.t("audio_playback"),iconPack:this.iconPack,t:this.t},this.t("audio_playback"))),this.showLatencyIndicator&&(0,s.h)("div",{class:"latency-controls"},(this.latency>10||this.latency<0)&&(0,s.h)("div",{class:"sync-live-stream",onClick:this.syncLiveStream},-1===this.latency?(0,s.h)("dyte-spinner",{id:"icon",part:"spinner",iconPack:this.iconPack,t:this.t,size:"sm"}):"Skip to Live")),a&&(0,s.h)("div",{class:"loader"},(0,s.h)("dyte-icon",{icon:this.iconPack.warning,t:this.t}),(0,s.h)("p",null,i)),!a&&r&&(0,s.h)("div",{class:"loader"},l&&(0,s.h)("dyte-spinner",{id:"icon",part:"spinner",iconPack:this.iconPack,t:this.t,size:"md"}),(0,s.h)("p",null,o))))}}}],[{key:"watchers",get:function(){return{meeting:["meetingChanged"]}}}]),e}();v.style=":host{line-height:initial;font-family:var(--dyte-font-family, sans-serif);margin-left:var(--dyte-space-2, 8px);margin-right:var(--dyte-space-2, 8px);display:flex;height:100%;width:100%;border-radius:var(--dyte-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--dyte-colors-background-900, 26 26 26) / var(--tw-bg-opacity))}.player-container{position:relative;margin:var(--dyte-space-4, 16px);display:flex;flex-grow:1;align-items:center;justify-content:center;overflow:hidden;border-radius:var(--dyte-border-radius-md, 8px)}video{z-index:0;height:100%;width:100%;border-radius:var(--dyte-border-radius-md, 8px);border-width:var(--dyte-border-width-none, 0);border-style:none;--tw-bg-opacity:1;background-color:rgba(var(--dyte-colors-background-1000, 8 8 8) / var(--tw-bg-opacity))}.loader{position:absolute;z-index:10;height:100%;width:100%;--tw-bg-opacity:1;background-color:rgba(var(--dyte-colors-background-900, 26 26 26) / var(--tw-bg-opacity));display:flex;flex-direction:column;align-items:center;justify-content:center}p{margin-top:var(--dyte-space-1, 4px);margin-bottom:var(--dyte-space-1, 4px);font-size:16px;color:rgb(var(--dyte-colors-text-700, 255 255 255 / 0.64))}.latency-controls{position:absolute;bottom:var(--dyte-space-4, 16px);right:var(--dyte-space-4, 16px);z-index:20;display:flex;flex-direction:row;align-items:center}.sync-live-stream{cursor:pointer;border-radius:var(--dyte-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--dyte-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));padding-left:var(--dyte-space-2, 8px);padding-right:var(--dyte-space-2, 8px);padding-top:var(--dyte-space-1, 4px);padding-bottom:var(--dyte-space-1, 4px);font-size:12px}.unmute-popup{position:absolute;z-index:30 !important;display:flex;width:var(--dyte-space-72, 288px);flex-direction:column;border-radius:var(--dyte-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--dyte-colors-background-800, 30 30 30) / var(--tw-bg-opacity));padding:var(--dyte-space-4, 16px);text-align:center;max-width:70%}.unmute-popup h3{margin:var(--dyte-space-0, 0px);font-size:16px;font-weight:500}.unmute-popup p{margin-top:var(--dyte-space-3, 12px);margin-bottom:var(--dyte-space-3, 12px);font-size:14px}"},5231:function(e,t,a){a.d(t,{P:function(){return i},a:function(){return o},b:function(){return u},c:function(){return c},d:function(){return n},e:function(){return l},f:function(){return d},i:function(){return r},s:function(){return s}});var i,n,r=function(e){return!!s(e)&&("LIVESTREAM"===e.meta.viewT
1ype&&"ON_STAGE"!==e.stage.status)},o=function(e){var t;return!!s(e)&&("LIVESTREAM"===e.meta.viewType&&(null===(t=null===e||void 0===e?void 0:e.self)||void 0===t?void 0:t.permissions.canLivestream))},s=function(e){var t;return(null===(t=null===e||void 0===e?void 0:e.self)||void 0===t?void 0:t.permissions.isV2)&&(null===e||void 0===e?void 0:e.livestream)};!function(e){e.BUFFERING="Buffering",e.ENDED="Ended",e.IDLE="Idle",e.PLAYING="Playing",e.READY="Ready"}(i||(i={})),function(e){e.INITIALIZED="PlayerInitialized",e.QUALITY_CHANGED="PlayerQualityChanged",e.DURATION_CHANGED="PlayerDurationChanged",e.VOLUME_CHANGED="PlayerVolumeChanged",e.MUTED_CHANGED="PlayerMutedChanged",e.PLAYBACK_RATE_CHANGED="PlayerPlaybackRateChanged",e.REBUFFERING="PlayerRebuffering",e.AUDIO_BLOCKED="PlayerAudioBlocked",e.PLAYBACK_BLOCKED="PlayerPlaybackBlocked",e.ERROR="PlayerError",e.RECOVERABLE_ERROR="PlayerRecoverableError",e.ANALYTICS_EVENT="PlayerAnalyticsEvent",e.TIME_UPDATE="PlayerTimeUpdate",e.BUFFER_UPDATE="PlayerBufferUpdate",e.SEEK_COMPLETED="PlayerSeekCompleted",e.SESSION_DATA="PlayerSessionData",e.STATE_CHANGED="PlayerStateChanged",e.WORKER_ERROR="PlayerWorkerError",e.METADATA="PlayerMetadata",e.TEXT_CUE="PlayerTextCue",e.TEXT_METADATA_CUE="PlayerTextMetadataCue",e.AD_CUE="PlayerAdCue",e.STREAM_SOURCE_CUE="PlayerStreamSourceCue",e.NETWORK_UNAVAILABLE="PlayerNetworkUnavailable",e.SEGMENT_DISCONTINUITY="PlayerSegmentDiscontinuity",e.SEGMENT_METADATA="PlayerSegmentMetadata",e.PLAYER_METADATA="PlayerMetadata"}(n||(n={}));var l=[n.TIME_UPDATE,n.BUFFER_UPDATE,n.TEXT_METADATA_CUE,n.PLAYER_METADATA],d=[n.REBUFFERING,n.AUDIO_BLOCKED,n.PLAYBACK_BLOCKED,n.ERROR,n.RECOVERABLE_ERROR,n.WORKER_ERROR,n.NETWORK_UNAVAILABLE,n.ANALYTICS_EVENT,n.PLAYBACK_RATE_CHANGED,n.QUALITY_CHANGED,n.INITIALIZED],c=function(e){var t,a,i,n,r,o;return!!s(e)&&("ALLOWED"===(null===(a=null===(t=null===e||void 0===e?void 0:e.self)||void 0===t?void 0:t.permissions)||void 0===a?void 0:a.canProduceAudio)||"ALLOWED"===(null===(n=null===(i=null===e||void 0===e?void 0:e.self)||void 0===i?void 0:i.permissions)||void 0===n?void 0:n.canProduceScreenshare)||"ALLOWED"===(null===(o=null===(r=null===e||void 0===e?void 0:e.self)||void 0===r?void 0:r.permissions)||void 0===o?void 0:o.canProduceVideo))},u=function(e){var t,a,i,n,r,o,l,d;return!!s(e)&&("NOT_ALLOWED"!==(null===(a=null===(t=null===e||void 0===e?void 0:e.self)||void 0===t?void 0:t.permissions)||void 0===a?void 0:a.canProduceAudio)||"NOT_ALLOWED"!==(null===(n=null===(i=null===e||void 0===e?void 0:e.self)||void 0===i?void 0:i.permissions)||void 0===n?void 0:n.canProduceScreenshare)||"NOT_ALLOWED"!==(null===(o=null===(r=null===e||void 0===e?void 0:e.self)||void 0===r?void 0:r.permissions)||void 0===o?void 0:o.canProduceVideo)||(null===(d=null===(l=null===e||void 0===e?void 0:e.self)||void 0===l?void 0:l.permissions)||void 0===d?void 0:d.canLivestream))}},1723:function(e,t,a){a.d(t,{P:function(){return i},s:function(){return c}});var i,n=a(9439),r=a(5671),o=a(3144),s=720,l=1280,d=function(e,t,a,i,n,r){var o,s,l,d,c=n,u=r,v=Math.min(a/c,i/u),y=c*v,p=u*v,h=1;return y<a&&(h=a/y),Math.abs(h-1)<1e-14&&p<i&&(h=i/p),(o=.5*(c-(l=c/((y*=h)/a))))<0&&(o=0),(s=.5*(u-(d=u/((p*=h)/i))))<0&&(s=0),l>c&&(l=c),d>u&&(d=u),[o,s,l,d,e,t,a,i]};!function(e){e.CAMERA="CAMERA",e.MIC="MIC",e.END="END"}(i||(i={}));var c=new(function(){function e(){(0,r.Z)(this,e),this.tracks=[],this.sources=[],this.enabled=!1}return(0,o.Z)(e,[{key:"isSupported",value:function(){return!!window.chrome&&document.pictureInPictureEnabled}},{key:"cleanup",value:function(){this.isSupported()&&void 0!==document.exitPictureInPicture&&null!==document.pictureInPictureElement&&document.exitPictureInPicture(),this.canvas=void 0,this.video=void 0,this.tracks=[],this.request=void 0}},{key:"createCanvas",value:function(){var e=document.createElement("canvas");e.height=s,e.width=l,this.canvas=e}},{key:"setupEvents",value:function(e){void 0!==navigator.mediaSession&&void 0!==navigator.mediaSession.setCameraActive&&navigator.mediaSession.setActionHandler("hangup",(function(){e(i.END)}))}},{key:"mountAudioEvents",value:function(e){void 0!==navigator.mediaSession&&void 0!==navigator.mediaSession.setCameraActive&&navigator.mediaSession.setActionHandler("togglemicrophone",(function(){e(i.MIC)}))}},{key:"mountVideoEvents",value:function(e){void 0!==navigator.mediaSession&&void 0!==navigator.mediaSession.setCameraActive&&navigator.mediaSession.setActionHandler("togglecamera",(function(){e(i.CAMERA)}))}},{key:"unmountAudioEvents",value:function(){void 0!==navigator.mediaSession&&void 0!==navigator.mediaSession.setCameraActive&&navigator.mediaSession.setActionHandler("togglemicrophone",void 0)}},{key:"unmountVideoEvents",value:function(){void 0!==navigator.mediaSession&&void 0!==navigator.mediaSession.setCameraActive&&navigator.mediaSession.setActionHandler("togglecamera",void 0)}}
1,{key:"drawGrid",value:function(e,t,a){if(void 0!==this.canvas){var i=this.canvas.getContext("2d");i.fillStyle="#000000",i.fillRect(0,0,l,s);for(var r=0,o=0;r<715;){for(var c=0;c<1275&&o<a;){var u=this.tracks[o],v=d(c,r,e,t,u.videoWidth,u.videoHeight),y=(0,n.Z)(v,8),p=y[0],h=y[1],m=y[2],f=y[3],g=y[4],E=y[5],P=y[6],A=y[7];i.drawImage(u,p,h,m,f,g,E,P,A),o+=1,c+=e}r+=t}}}},{key:"paintCanvas",value:function(){var e=this.tracks.length,t=function(e){switch(e){case 0:case 1:return[l,s];case 2:return[Math.floor(640),s];case 3:case 4:return[Math.floor(640),Math.floor(360)];default:return[Math.floor(426.6666666666667),Math.floor(360)]}}(e),a=(0,n.Z)(t,2),i=a[0],r=a[1];this.drawGrid(i,r,e)}},{key:"animate",value:function(){var e=this;void 0!==this.tracks&&this.paintCanvas(),void 0!==this.request&&(this.request=requestAnimationFrame((function(){return e.animate()})))}},{key:"create",value:function(e,t,a){var i=this;this.cleanup(),this.createCanvas(),this.setupEvents(a);var n=document.createElement("video");n.height=s,n.width=l,n.autoplay=!0,n.srcObject=this.canvas.captureStream(24),this.video=n,this.video.onloadedmetadata=function(){try{e(),i.video.onleavepictureinpicture=function(){t()}}catch(a){t(a.getMessage())}},this.paintCanvas()}},{key:"updateMediaSession",value:function(e,t){void 0!==navigator.mediaSession&&(e===i.CAMERA&&void 0!==navigator.mediaSession.setCameraActive&&navigator.mediaSession.setCameraActive(t),e===i.MIC&&void 0!==navigator.mediaSession.setMicrophoneActive&&navigator.mediaSession.setMicrophoneActive(t))}},{key:"updateVideoSources",value:function(){var e=Object.values(this.sources).filter((function(e){return e.enabled})),t=[];e.map((function(e){t.push(e.element)})),this.tracks=t}},{key:"enableSource",value:function(e){void 0!==this.sources[e]&&(this.sources[e].enabled=!0),this.updateVideoSources()}},{key:"disableSource",value:function(e){void 0!==this.sources[e]&&(this.sources[e].enabled=!1),this.updateVideoSources()}},{key:"addSource",value:function(e,t,a){this.sources[e]={element:t,enabled:a}}},{key:"removeSource",value:function(e){delete this.sources[e]}},{key:"removeAllSource",value:function(){this.sources=[]}},{key:"enable",value:function(){var e=this;this.enabled=!0,this.request=requestAnimationFrame((function(){return e.animate()})),this.video.requestPictureInPicture()}},{key:"disable",value:function(){this.enabled=!1,cancelAnimationFrame(this.request),this.request=void 0,document.exitPictureInPicture()}}]),e}())}}]); 2//# sourceMappingURL=8715.7aec690c.chunk.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.