UNPKG

@zoom/meetingsdk

Version:
1 lines 18.6 kB
"use strict";(self.webpackChunk_zoom_webclientjs=self.webpackChunk_zoom_webclientjs||[]).push([[7740],{69138:(e,o,n)=>{n.d(o,{X:()=>c});class c{constructor(e={}){this._onError="function"===typeof e.onError?e.onError:null,this._pending=[],this._pumping=!1}enqueue(e){return"function"!==typeof e?Promise.reject(new TypeError("AsyncSerialTaskQueue.enqueue expects a function")):new Promise((o,n)=>{this._pending.push({run:e,res:o,rej:n}),this._pump()})}clear(){const e=this._pending.splice(0);for(const o of e)o.res()}getDepth(){return this._pending.length}_pump(){this._pumping||(this._pumping=!0,(()=>{return e=this,o=null,n=function*(){for(;this._pending.length;){const{run:n,res:c,rej:r}=this._pending.shift();try{yield n(),c()}catch(e){if(this._onError)try{this._onError(e)}catch(o){}r(e)}}this._pumping=!1},new Promise((c,r)=>{var i=e=>{try{l(n.next(e))}catch(o){r(o)}},t=e=>{try{l(n.throw(e))}catch(o){r(o)}},l=e=>e.done?c(e.value):Promise.resolve(e.value).then(i,t);l((n=n.apply(e,o)).next())});var e,o,n})())}}},21527:(e,o,n)=>{n.d(o,{k:()=>t});const c=["lifecycleId","lifeCycleID","parentLifecycleId"];const r=["background: #4a4a52","color: #f3f4f6","font-weight: 600","padding: 5px 10px","border-left: 4px solid #9ca3af","border-radius: 3px"].join("; ");function i(e){if("(none)"===e)return r;const o=function(e){let o=2166136261;for(let n=0;n<e.length;n++)o^=e.charCodeAt(n),o=Math.imul(o,16777619);return Math.abs(o)%360}(e);return[`background: linear-gradient(90deg, hsl(${o}, 52%, 30%) 0%, hsl(${o}, 38%, 20%) 100%)`,"color: #f8fafc","font-weight: 700","padding: 5px 10px",`border-left: 4px solid hsl(${o}, 88%, 58%)`,"border-radius: 3px"].join("; ")}function t(e,o,n){const r=console[e]||console.log;if(void 0===n)return void r(o);const t=function(e){if(!e||"object"!==typeof e)return null;for(let o=0;o<c.length;o++){const n=c[o];if(Object.prototype.hasOwnProperty.call(e,n)){const o=e[n];if(null!=o&&""!==o)return String(o)}}return null}(n);if(null==t)return void r(o,n);r(`%c${`${o} | ${t}`}`,i(t),n)}},45226:(e,o,n)=>{n.d(o,{T:()=>r,Y:()=>c});const c="luna://com.webos.service.hccmanager",r="Remote Controller"},57740:(e,o,n)=>{n.r(o),n.d(o,{cancelMicButtonSubscription:()=>H,cancelRecordVoiceSubscription:()=>X,clearLgMicAudioQueue:()=>b,enqueueLgMicAudioTask:()=>S,ensureMicButtonSubscription:()=>Z,flushLgMicAudioQueue:()=>L,getInRecordVoiceSession:()=>R,getMicRemoteActionBusy:()=>F,isRecordVoiceStartupInFlight:()=>O,markDeferredJoinEdgeCancel:()=>q,resetMicButtonSubscriberState:()=>$,setInRecordVoiceSession:()=>M,setLgStore:()=>k,setMicRemoteActionBusy:()=>j,startRecordVoiceDefaultThenGum:()=>z,startRecordVoiceSubscription:()=>Y,subscribeMicButtonPressed:()=>ee});var c=n(23422),r=n(29392),i=n(60780),t=n(33585),l=n(45226),s=n(50498),u=n(97502),a=n(18306),d=n(69138),f=n(21527),p=(e,o,n)=>new Promise((c,r)=>{var i=e=>{try{l(n.next(e))}catch(o){r(o)}},t=e=>{try{l(n.throw(e))}catch(o){r(o)}},l=e=>e.done?c(e.value):Promise.resolve(e.value).then(i,t);l((n=n.apply(e,o)).next())});const g="luna://com.webos.service.voiceconductor",m="recordVoice",v="key/isMicButtonPressed",y=500;let h=null;const w=new d.X({onError:e=>{console.warn("[LG-mic] lgMicAudioQueue task failed",{error:String(e)})}});function S(e){return w.enqueue(e)}function b(){w.clear()}function L(){return S(()=>{})}function k(e){h=e,e||b()}let G=null,V=null,I=!1;const R=()=>I,M=e=>{I=e};let T=0,P=null;function C(e){P&&((0,f.k)("warn","[LG-mic] recordVoice lifecycle cleared",{lifecycleId:P,reason:e}),P=null)}let B=null,A=null,_=!1;const F=()=>_,j=e=>{const o=document.querySelector("button.join-audio-container__btn");o&&(o.disabled=e),_=e};let E=0,x=!1,D=!1;function O(){return x}function q(){D=!0}function U(){var e,o;const n=null==(o=null==(e=null==window?void 0:window.webOS)?void 0:e.service)?void 0:o.request;return"function"===typeof n?n:null}function H(){if(B&&"function"===typeof B.cancel)try{B.cancel(),console.warn("[LG-mic] cancelMicButtonSubscription \u2014 subscription cancelled")}catch(e){console.error("[LG-mic] cancelMicButtonSubscription \u2014 cancel threw",e)}B=null}function $(){}function Q(e){var o,n,c,r,i;const t=null!=e?e:null==(o=null==h?void 0:h.getState)?void 0:o.call(h),s=null==(n=null==t?void 0:t.audio)?void 0:n.activeMicrophone,u=null==(c=null==t?void 0:t.audio)?void 0:c.microphoneDevicesList;if(!s||!Array.isArray(u))return!1;const a=u.find(e=>e.deviceId===s);return null!=(i=null==(r=null==a?void 0:a.label)?void 0:r.includes(l.T))&&i}function J(e){const o={};return e&&(o.voiceTicket=e),o}function N(e){return p(this,null,function*(){console.warn("[LG-mic] requestStopRecordingVoice \u2014 called",{voiceTicket:e||"(none)",webOSAvailable:!!U()});const o=U();if(o)return new Promise(function(n,c){try{o(g,{method:"stopRecordingVoice",parameters:J(e),subscribe:!1,onSuccess:function(o){console.warn("confcall-api-success",{serviceUri:"luna://com.webos.service.voiceconductor",method:"stopRecordingVoice",voiceTicket:e||"",payload:o}),n(o)},onFailure:function(e){console.error("confcall-api-failure",{method:"stopRecordingVoice",error:e}),c(e)}})}catch(r){console.error("confcall-api-exception",{method:"stopRecordingVoice",error:String(r)}),c(r)}});console.error("confcall-api-failure",{method:"stopRecordingVoice",error:"webOS service unavailable"})})}function X(){if((0,f.k)("warn","[LG-mic] cancelRecordVoiceSubscription \u2014 called",{lifecycleId:P||"(none)",hasSubscription:!!G,hasCancelFn:"function"===typeof(null==G?void 0:G.cancel),currentVoiceTicket:V||"(none)"}),G&&"function"===typeof G.cancel)try{G.cancel(),console.warn("[LG-mic] cancelRecordVoiceSubscription \u2014 subscription cancelled successfully")}catch(e){console.error("Failed to cancel LG voice conductor subscription | recordVoice",e)}else console.warn("[LG-mic] cancelRecordVoiceSubscription \u2014 no active subscription to cancel");G=null,V=null,M(!1)}function Y(e){return p(this,null,function*(){const o=U();if((0,f.k)("warn","[LG-mic] startRecordVoiceSubscription \u2014 called",{lifecycleId:P||"(none)",params:e,webOSAvailable:!!o,currentVoiceTicket:V||"(none)",inRecordVoiceSession:R(),hasExistingSubscription:!!G}),!o)return console.error("[LG-mic] startRecordVoiceSubscription \u2014 aborted: webOS service unavailable"),!1;if(R()&&G&&V)return(0,f.k)("warn","[LG-mic] startRecordVoiceSubscription \u2014 skipped: session already active",{lifecycleId:P||"(none)",currentVoiceTicket:V}),!0;T+=1,P=`${"recordVoice"}-${Date.now().toString(36)}-${T.toString(36)}`,x=!0;try{return(0,f.k)("log","[LG-mic] startRecordVoiceSubscription \u2014 running stopRecordingVoiceFlow first",{lifecycleId:P}),yield function(){return p(this,null,function*(){const e=V;(0,f.k)("warn","[LG-mic] stopRecordingVoiceFlow \u2014 start",{lifecycleId:P||"(none)",voiceTicket:e||"(none)",inRecordVoiceSession:R(),hasSubscription:!!G});try{yield N(e),console.warn("[LG-mic] stopRecordingVoiceFlow \u2014 requestStopRecordingVoice resolved")}catch(o){(0,f.k)("error","[LG-mic] stopRecordingVoiceFlow \u2014 requestStopRecordingVoice threw",{lifecycleId:P||"(none)",error:String(o)})}finally{X(),(0,f.k)("warn","[LG-mic] stopRecordingVoiceFlow \u2014 complete, voiceTicket cleared",{lifecycleId:P||"(none)"})}})}(),(0,f.k)("warn","[LG-mic] startRecordVoiceSubscription \u2014 stop flow complete, subscribing now",{lifecycleId:P}),yield new Promise(function(n,c){let i=!1;const t=function(e){i||(i=!0,e||C("startup-finish-false"),n(e))};try{(0,f.k)("warn","[LG-mic] startRecordVoiceSubscription \u2014 calling window.webOS.service.request for recordVoice",{lifecycleId:P,params:e}),G=o(g,{method:m,parameters:e,subscribe:!0,onSuccess:function(e){var o,n,c;const l=P||"(none)",a=V;e&&e.voiceTicket&&(V=e.voiceTicket,a!==V&&(0,f.k)("warn","[LG-mic] recordVoice onSuccess \u2014 voiceTicket updated",{lifecycleId:l,prevTicket:a,newTicket:V})),function(e){if(!e||"object"!==typeof e)return void console.error("[LG-mic] syncInRecordVoiceSessionFromPayload \u2014 ignored: invalid payload",{payload:e});const o=e.event,n=R();"recordingStart"===o?(M(!0),console.warn("[LG-mic] syncInRecordVoiceSessionFromPayload \u2014 recordingStart",{before:n,after:R()})):"recordingStop"===o?(M(!1),console.warn("[LG-mic] syncInRecordVoiceSessionFromPayload \u2014 recordingStop",{before:n,after:R()})):"failure"===o||e.errorCode?(M(!1),console.error("[LG-mic] syncInRecordVoiceSessionFromPayload \u2014 failure/errorCode",{event:o,errorCode:e.errorCode,before:n,after:R()})):console.log("[LG-mic] syncInRecordVoiceSessionFromPayload \u2014 unhandled event, no state change",{event:o,inRecordVoiceSession:R()})}(e);const d=null!=(o=null==e?void 0:e.event)?o:"unknown";if((0,f.k)("warn","recordvoice-event",{lifecycleId:l,event:d,socketPath:null!=(n=null==e?void 0:e.socketPath)?n:"",voiceTicket:null!=(c=null==e?void 0:e.voiceTicket)?c:"",returnValue:null==e?void 0:e.returnValue,raw:e}),"recordingStop"===d||"recordingStart"===d){const e=l,o=d;S(()=>{var n,c,i;if("recordingStop"===o)if((0,s.C)()){const o=(0,u.e0)();o?((0,f.k)("warn","[LG-mic] recordVoice onSuccess \u2014 recordingStop in preview, calling mutePreviewAudio",{lifecycleId:e}),o.mute()):(0,f.k)("warn","[LG-mic] recordVoice onSuccess \u2014 recordingStop in preview but no preview actions registered (preview hook not mounted)",{lifecycleId:e})}else{const o=null==h?void 0:h.dispatch,t=null==(i=null==(c=null==(n=null==h?void 0:h.getState)?void 0:n.call(h))?void 0:c.meeting)?void 0:i.currentUser;"function"===typeof o&&null!=(null==t?void 0:t.userId)?((0,f.k)("warn","[LG-mic] recordVoice onSuccess \u2014 recordingStop received, dispatching muteAudio",{lifecycleId:e,userId:t.userId}),o((0,r.Mo)(t.userId))):(0,f.k)("error","[LG-mic] recordVoice onSuccess \u2014 recordingStop ignored: store or current user unavailable",{lifecycleId:e,hasDispatch:"function"===typeof o,userId:null==t?void 0:t.userId})}else if("recordingStart"===o)if((0,s.C)()){const o=(0,u.e0)();o?((0,f.k)("warn","[LG-mic] recordVoice onSuccess \u2014 recordingStart in preview, calling unmutePreviewAudio",{lifecycleId:e}),o.unmute()):(0,f.k)("warn","[LG-mic] recordVoice onSuccess \u2014 recordingStart in preview but no preview actions registered (preview hook not mounted)",{lifecycleId:e})}else(0,f.k)("log","[LG-mic] recordVoice onSuccess \u2014 recordingStart in meeting, no audio side-effect",{lifecycleId:e})}).catch(()=>{})}else(0,f.k)("log","[LG-mic] recordVoice onSuccess \u2014 event has no audio side-effect",{lifecycleId:l,eventType:d});i?(0,f.k)("log","[LG-mic] recordVoice onSuccess \u2014 promise already settled, ignoring",{lifecycleId:l,eventType:d}):e&&!1===e.returnValue?((0,f.k)("error","[LG-mic] recordVoice onSuccess \u2014 returnValue false, resolving finish(false)",{lifecycleId:l,payload:e}),t(!1)):((0,f.k)("warn","[LG-mic] recordVoice onSuccess \u2014 resolving finish(true)",{lifecycleId:l,eventType:d}),t(!0))},onFailure:function(e){const o=P||"(none)";(0,f.k)("error","recordvoice-event",{lifecycleId:o,event:"failure",error:e}),(0,f.k)("error","[LG-mic] recordVoice onFailure \u2014 subscription failed",{lifecycleId:o,error:e,settled:i}),G=null,V=null,M(!1),C("subscription-onFailure"),i||(i=!0,c(e))}})}catch(l){(0,f.k)("error","[LG-mic] startRecordVoiceSubscription \u2014 exception thrown when calling webOS.service.request",{lifecycleId:P||"(none)",error:String(l)}),i||(i=!0),C("startup-exception"),c(l)}})}finally{!function(){var e;if(!D)return;if(D=!1,!h)return;const o=h.getState();(0,a.V)(o)&&!(null==(e=o.meeting.currentUser)?void 0:e.muted)||X()}(),x=!1,G||C("startup-finally-no-subscription")}})}function z(e){return p(this,null,function*(){var o,n;if((0,f.k)("warn","[LG-mic] startRecordVoiceDefaultThenGum \u2014 called",{parentLifecycleId:null!=e?e:"(none)",inRecordVoiceSession:R(),currentVoiceTicket:V||"(none)"}),R()&&G&&V)return(0,f.k)("warn","[LG-mic] startRecordVoiceDefaultThenGum \u2014 skipped: already in recordVoice session",{parentLifecycleId:null!=e?e:"(none)",currentVoiceTicket:V}),!1;if(!Q(null==(o=null==h?void 0:h.getState)?void 0:o.call(h)))return(0,f.k)("warn","[LG-mic] startRecordVoiceDefaultThenGum \u2014 skipped: active mic is not Remote Controller",{parentLifecycleId:null!=e?e:"(none)"}),!1;try{const o=yield Y({subscribe:!0,socketType:"none"});if((0,f.k)("warn","[LG-mic] startRecordVoiceDefaultThenGum \u2014 startRecordVoiceSubscription resolved",{parentLifecycleId:null!=e?e:"(none)",recordOk:o}),!o)return(0,f.k)("error","[LG-mic] startRecordVoiceDefaultThenGum \u2014 recordVoice failed, skipping GUM",{parentLifecycleId:null!=e?e:"(none)"}),!1}catch(a){return(0,f.k)("error","[LG-mic] startRecordVoiceDefaultThenGum \u2014 startRecordVoiceSubscription threw",{parentLifecycleId:null!=e?e:"(none)",error:String(a)}),!1}(0,f.k)("warn","[LG-mic] startRecordVoiceDefaultThenGum \u2014 recordVoice OK, proceeding to getUserMedia",{parentLifecycleId:null!=e?e:"(none)"});const c=null==h?void 0:h.getState(),r=null==(n=null==c?void 0:c.meeting)?void 0:n.currentUser;if(!(null==c?void 0:c.audio)||!(null==r?void 0:r.userId))return(0,f.k)("error","[LG-mic] startRecordVoiceDefaultThenGum \u2014 aborted: store or current user unavailable",{parentLifecycleId:null!=e?e:"(none)",hasStore:!!h,hasState:!!c,hasAudioState:!!(null==c?void 0:c.audio),userId:null==r?void 0:r.userId}),!1;const{activeMicrophone:l,microphoneDevicesList:s=[]}=c.audio,u=s.find(e=>e.deviceId===l);return i.C.avSocket.sendSocket(t.CHANGE_AUDIO_MIC,{ssrc:0,AudioSelectValue:"default"===l?null:l,microphoneLabel:null==u?void 0:u.label,defaultMuted:null==r?void 0:r.muted}),!0})}function K(e){const o=U();if(console.warn("[LG-mic] subscribeMicButtonPressedCore \u2014 called",{hasActiveSubscription:!!B,webOSRequestAvailable:!!o}),H(),!o)return console.error("[LG-mic] subscribeMicButtonPressedCore \u2014 aborted: webOS.service.request is not a function"),()=>{};const n=o=>{console.log("[LG-mic] core \u2014 raw payload received",{payload:o});const n=function(e){if(console.log("[LG-mic] parseMicButtonPressedState \u2014 raw payload:",e),null==e||"object"!==typeof e)return console.error("[LG-mic] parseMicButtonPressedState \u2014 rejected: payload is null or not an object",{payload:e}),null;if(!1===e.returnValue)return console.error("[LG-mic] parseMicButtonPressedState \u2014 rejected: returnValue is false",{payload:e}),null;if(!Object.prototype.hasOwnProperty.call(e,"pressed"))return console.error('[LG-mic] parseMicButtonPressedState \u2014 rejected: no "pressed" key',{payloadKeys:Object.keys(e)}),null;const o=e.pressed;return console.log("[LG-mic] parseMicButtonPressedState \u2014 pressed value:",o),!0===o||"true"===o||1===o?(console.log("[LG-mic] parseMicButtonPressedState \u2192 true (pressed)",{rawValue:o}),!0):!1===o||"false"===o||0===o?(console.log("[LG-mic] parseMicButtonPressedState \u2192 false (released)",{rawValue:o}),!1):(console.error("[LG-mic] parseMicButtonPressedState \u2014 rejected: unrecognised pressed value",{rawValue:o}),null)}(o);if(console.log("[LG-mic] core \u2014 pressed value:",n),null===n)return void console.error("[LG-mic] core \u2014 ignored: parseMicButtonPressedState returned null");const c=!0===A,r=c&&!1===n,i=A;if(A=n,console.log("[LG-mic] core \u2014 edge detection",{pressed:n,wasPressed:c,isReleaseEdge:r,prevLastHccMicPressed:i,lastHccMicPressed:A}),!r)return void console.log("[LG-mic] core \u2014 not a release edge, no action");const t=Date.now(),l=t-E;if(l<y)console.warn("[LG-mic] core \u2014 debounced (too soon)",{timeSinceLast:l,debounceMs:y});else{E=t;try{e()}catch(s){console.error("[LG-mic] core \u2014 onReleaseEdge threw",{error:String(s)})}}};console.warn("[LG-mic] core \u2014 registering HCC subscription",{serviceUri:l.Y,method:v});try{B=o(l.Y,{method:v,parameters:{subscribe:!0},onSuccess:function(e){console.log("[LG-mic] core \u2014 HCC isMicButtonPressed onSuccess",{payload:e}),n(e)},onFailure:function(e){console.error("[LG-mic] core \u2014 HCC subscription onFailure",{error:e})},subscribe:!0}),console.warn("[LG-mic] core \u2014 HCC subscription registered successfully")}catch(r){return console.error("[LG-mic] core \u2014 exception during HCC subscribe call",{error:String(r)}),()=>{}}const c=B;return function(){B===c&&H()}}function W(){if(F())console.warn("[LG-mic] handleMicButtonReleaseEdge \u2014 release edge skipped: micRemoteActionBusy is true");else{if((0,s.C)()){const e=(0,u.b2)();return void("function"===typeof e?(console.warn("[LG-mic] handleMicButtonReleaseEdge \u2014 isInPreview, calling handleAudioClick"),Y({subscribe:!0,socketType:"none"}),e()):console.warn("[LG-mic] handleMicButtonReleaseEdge \u2014 isInPreview but no handleAudioClick registered (preview hook not mounted)"))}h?(console.warn("[LG-mic] handleMicButtonReleaseEdge \u2014 not in preview, calling toggleMute"),function(e){p(this,null,function*(){const{getState:o,dispatch:n}=e,{meeting:{currentUser:i}}=o();if(console.warn("[LG-mic] toggleMute \u2014 evaluating",{userId:null==i?void 0:i.userId,isJoinAudio:(0,c.lc)(i),muted:null==i?void 0:i.muted,inRecordVoiceSession:R(),micRemoteActionBusy:_}),(null==i?void 0:i.userId)&&(0,c.lc)(i)){j(!0);try{if(i.muted){if(!Q(o()))return console.warn("[LG-mic] toggleMute \u2014 active mic is not Remote Controller, dispatching UNMUTE without recordVoice flow"),void(yield n((0,r.pb)(i.userId)));console.warn("[LG-mic] toggleMute \u2014 dispatching UNMUTE + starting recordVoice flow"),yield z().catch(()=>{}).then(()=>n((0,r.pb)(i.userId)))}else{console.warn("[LG-mic] toggleMute \u2014 user is unmuted \u2192 stopping recordVoice (will mute)"),n((0,r.Mo)(null==i?void 0:i.userId));const e=V;X(),N(e).catch(e=>{console.error("[LG-mic] toggleMute \u2014 background stopRecordingVoice failed (state already cleared)",{error:String(e)})})}}finally{j(!1)}}else console.warn("[LG-mic] toggleMute \u2014 skipped: audio not connected",{userId:null==i?void 0:i.userId,isJoinAudio:(0,c.lc)(i)})})}(h)):console.error("[LG-mic] handleMicButtonReleaseEdge \u2014 in-meeting release edge but lgStore is null; cannot toggleMute")}}function Z(){return B?(console.log("[LG-mic] ensureMicButtonSubscription \u2014 already active, no-op"),()=>{}):(console.warn("[LG-mic] ensureMicButtonSubscription \u2014 registering default HCC handler"),K(W))}function ee(e){return console.warn("[LG-mic] subscribeMicButtonPressed \u2014 called",{hasStore:!!e}),k(e),H(),Z()}},50498:(e,o,n)=>{n.d(o,{C:()=>r,X:()=>i});var c=n(52270);const r=()=>!!c.Task.getPendingTasks().concat(c.Task.getRunningTasks()).find(e=>e.isPreview),i=()=>c.Task.getPendingTasks().concat(c.Task.getRunningTasks()).filter(e=>e.isPreview||e.isWaitingForHost)}}]);