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SAAS,SAAS,IAAM,CAAC/B,KACzBG,EAAG,KACD,QAAayB,EAAsB,CACrCxD,KAAM,UACNgE,QAASb,GACR,CACDQ,SAAS,SAAS,IAAM,CAAC9B,KACzBE,EAAG,MACCD,GAAY,IAAAC,GAAoB,MAAOC,EAAY,GAAE,SAAW,IAAO,QAAoB,KAAW,MAAM,SAAY,QAAOK,GAAOY,sBAAsBgB,KACzJ,WAAc,QAAoB,MAAO,CAC9CC,IAAKD,EAAK5D,QACVD,GAAI6D,EAAK5D,QACTsB,MAAO,CACL,YAAa,QACb,aAAc,SAEf,KAAM,EAAGM,MACV,WACJF,EAAG,OAELA,EAAG,Q,QCtJX,MAAMoC,GAA2B,OAAgB,EAAQ,CAAC,CAAC,YAAY,qBAEvE","sources":["webpack://quick-vue3/./src/utils/client.ts","webpack://quick-vue3/./src/views/Invite.vue","webpack://quick-vue3/./src/views/Invite.vue?5be7"],"sourcesContent":["/* eslint-disable no-underscore-dangle */\nimport TRTC, {\n Client, LocalStream, RemoteStream,\n} from 'trtc-js-sdk';\nimport { ElMessage } from 'element-plus/es';\nimport { genTestUserSig } from '@/utils/generateTestUserSig';\nimport { ClientOptions } from '@/types/type';\n\nclass LocalClient {\n private sdkAppId: number;\n\n private userId: string;\n\n private secretKey: string;\n\n private roomId: number;\n\n private userSig: string;\n\n private client: Client;\n\n private localStream: LocalStream;\n\n private isJoined: boolean;\n\n private isPublished: boolean;\n\n private remoteStreams: RemoteStream[];\n\n private video: boolean;\n\n private audio: boolean;\n\n private cameraId: any;\n\n private microphoneId: any;\n\n constructor(options: ClientOptions) {\n const {\n sdkAppId, userId, roomId, secretKey, userSig,\n } = options;\n this.sdkAppId = sdkAppId;\n this.userId = userId;\n this.secretKey = secretKey;\n this.userSig = userSig;\n this.roomId = roomId;\n\n this.client = null;\n this.localStream = null;\n this.remoteStreams = [];\n\n this.isJoined = false;\n this.isPublished = false;\n\n this.cameraId = '';\n this.microphoneId = '';\n\n this.video = true;\n this.audio = true;\n\n this.initClient();\n }\n\n initClient() {\n const userSig = this.userSig || genTestUserSig({\n sdkAppId: this.sdkAppId,\n userId: this.userId,\n secretKey: this.secretKey,\n }).userSig;\n\n try {\n this.client = TRTC.createClient({\n mode: 'rtc', sdkAppId: this.sdkAppId, userId: this.userId, userSig,\n });\n console.log(`Client [${this.userId}] created.`);\n this.installEventHandlers();\n } catch (e) {\n console.log(`Failed to create Client [${this.userId}].`);\n }\n }\n\n createShareLink() {\n const userId = String(Math.floor(Math.random() * 1000000));\n const { userSig } = genTestUserSig({\n sdkAppId: this.sdkAppId,\n userId,\n secretKey: this.secretKey,\n });\n const { origin } = window.location;\n const pathname = window.location.pathname.replace('index.html', 'invite/invite.html');\n return `${origin}${pathname}?userSig=${userSig}&&SDKAppId=${this.sdkAppId}&&userId=${userId}&&roomId=${this.roomId}`;\n }\n\n async initLocalStream() {\n try {\n this.localStream = TRTC.createStream({\n userId: this.userId,\n audio: true,\n video: true,\n cameraId: this.cameraId,\n microphoneId: this.microphoneId,\n });\n this.localStream.setVideoProfile('480p');\n try {\n await this.localStream.initialize();\n console.log(`LocalStream [${this.userId}] initialized`);\n } catch (e: any) {\n console.log(`LocalStream failed to initialize. Error: ${e.message_}`);\n }\n } catch (e: any) {\n console.log(`${this.userId} failed to create LocalStream. Error: ${e.message_}`);\n }\n }\n\n // join room\n async join() {\n console.log('join room clicked');\n\n try {\n await this.client.join({ roomId: this.roomId });\n this.isJoined = true;\n console.log(`Join room [${this.roomId}] success`);\n try {\n await this.initLocalStream();\n } catch (error: any) {\n console.log(`Init LocalStream failed. Error: ${error.message_}`);\n }\n } catch (e: any) {\n console.log(`Join room ${this.roomId} failed, please check your params. Error: ${e.message_}`);\n }\n }\n\n async publish() {\n if (!this.isJoined) {\n console.warn('call publish()- please join() firstly');\n return;\n }\n if (this.isPublished) {\n console.warn('duplicate publish() observed');\n return;\n }\n if (!this.localStream) {\n return;\n }\n try {\n await this.client.publish(this.localStream);\n this.isPublished = true;\n console.log('LocalStream is published successfully');\n } catch (error: any) {\n console.log(`LocalStream is failed to publish. Error: ${error.message_}`);\n }\n }\n\n async unpublish() {\n if (!this.isJoined) {\n console.warn('unpublish() - please join() firstly');\n return;\n }\n if (!this.isPublished) {\n console.warn('call unpublish() - you have not published yet');\n return;\n }\n try {\n await this.client.unpublish(this.localStream);\n this.isPublished = false;\n console.log('Unpublish localStream success');\n } catch (error: any) {\n console.log(`LocalStream is failed to unpublish. Error: ${error.message_}`);\n }\n }\n\n async leave() {\n if (!this.isJoined) {\n console.warn('leave() - please join() firstly');\n return;\n }\n await this.unpublish();\n try {\n await this.client.leave();\n console.log('Leave room success');\n this.isJoined = false;\n if (this.localStream) {\n this.localStream.stop();\n this.localStream.close();\n this.localStream = null;\n }\n } catch (error: any) {\n console.error('leave failed', error);\n console.log(`Leave room failed. Error: ${error.message_}`);\n }\n }\n\n async switchDevice({ videoId, audioId }: { videoId: string, audioId: string }) {\n if (!this.isJoined) {\n return;\n }\n if (videoId) {\n try {\n await this.localStream.switchDevice('video', videoId);\n console.log('Switch video device success');\n } catch (error: any) {\n console.error('switchDevice failed', error);\n console.log('Switch video device failed');\n }\n }\n if (audioId) {\n try {\n await this.localStream.switchDevice('audio', audioId);\n console.log('Switch audio device success');\n } catch (error: any) {\n console.error('switchDevice failed', error);\n console.log('Switch audio device failed');\n }\n }\n }\n\n installEventHandlers() {\n this.client.on('error', this.handleError.bind(this));\n this.client.on('client-banned', this.handleBanned.bind(this));\n this.client.on('peer-join', this.handlePeerJoin.bind(this));\n this.client.on('peer-leave', this.handlePeerLeave.bind(this));\n this.client.on('stream-added', this.handleStreamAdded.bind(this));\n this.client.on('stream-updated', this.handleStreamUpdated.bind(this));\n this.client.on('connection-state-changed', this.handleConnection.bind(this));\n this.client.on('mute-video', this.handleMuteVideo.bind(this));\n this.client.on('mute-audio', this.handleMuteAudio.bind(this));\n this.client.on('unmute-video', this.handleUnmuteVideo.bind(this));\n this.client.on('unmute-audio', this.handleUnmuteAudio.bind(this));\n }\n\n handleMuteVideo(event: any) {\n console.log(`[${event.userId}] mute video`);\n }\n\n handleMuteAudio(event: any) {\n console.log(`[${event.userId}] mute audio`);\n }\n\n handleUnmuteVideo(event: any) {\n console.log(`[${event.userId}] unmute video`);\n }\n\n handleUnmuteAudio(event: any) {\n console.log(`[${event.userId}] unmute audio`);\n }\n\n handleError(error: any) {\n ElMessage({ message: error.message_, type: 'error' });\n console.log(`RTCError: ${error.message_}`);\n }\n\n handleBanned(event: any) {\n console.warn(`client has been banned for ${event.reason}`);\n }\n\n handlePeerJoin(event: any) {\n const { userId } = event;\n if (userId !== 'local-screen') {\n console.log(`Peer Client [${userId}] joined`);\n }\n }\n\n handlePeerLeave(event: any) {\n const { userId } = event;\n if (userId !== 'local-screen') {\n console.log(`[${userId}] leave`);\n }\n }\n\n handleStreamAdded(event: any) {\n const remoteStream = event.stream;\n const id = remoteStream.getId();\n const userId = remoteStream.getUserId();\n\n if (remoteStream.getUserId() === `share_${this.userId}`) {\n // don't need screen shared by us\n this.client.unsubscribe(remoteStream).catch(() => {\n console.log(`Unsubscribe [${userId}] failed`);\n });\n } else {\n console.log(`remote stream added: [${userId}] ID: ${id} type: ${remoteStream.getType()}`);\n this.client.subscribe(remoteStream).catch(() => {\n console.log(`Subscribe [${userId}] failed`);\n });\n }\n }\n\n handleStreamSubscribed(event: any) {\n const remoteStream = event.stream;\n const id = remoteStream.getId();\n const userId = remoteStream.getUserId();\n console.log(`RemoteStream subscribed: [${userId}]`);\n\n this.remoteStreams.push(remoteStream);\n console.log('stream-subscribed ID: ', id);\n }\n\n handleStreamRemoved(event: any) {\n const remoteStream = event.stream;\n const id = remoteStream.getId();\n const userId = remoteStream.getUserId();\n remoteStream.stop();\n if (remoteStream.getUserId() !== `share_${this.userId}`) {\n console.log(`RemoteStream removed: [${userId}]`);\n }\n this.remoteStreams = this.remoteStreams.filter((stream) => stream.getId() !== id);\n }\n\n handleStreamUpdated(event: any) {\n const remoteStream = event.stream;\n const userId = remoteStream.getUserId();\n\n console.log(`RemoteStream updated: [${userId}] audio:${remoteStream.hasAudio()} video:${remoteStream.hasVideo()}`);\n }\n\n handleConnection(event: any) {\n console.log(`connection state changed: ${event.state}`);\n }\n\n getClient() {\n return this.client;\n }\n\n getLocalStream() {\n return this.localStream;\n }\n}\n\nexport default LocalClient;\n","import { defineComponent as _defineComponent } from 'vue';\nimport { unref as _unref, toDisplayString as _toDisplayString, createElementVNode as _createElementVNode, createTextVNode as _createTextVNode, resolveComponent as _resolveComponent, withCtx as _withCtx, createVNode as _createVNode, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, createBlock as _createBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from \"vue\";\n\nconst _withScopeId = n => (_pushScopeId(\"data-v-ca3824de\"), n = n(), _popScopeId(), n);\n\nconst _hoisted_1 = {\n class: \"invite\"\n};\nconst _hoisted_2 = {\n class: \"share-link\"\n};\nconst _hoisted_3 = {\n class: \"alert\"\n};\nconst _hoisted_4 = {\n style: {\n \"padding-top\": \"10px\"\n }\n};\n\nconst _hoisted_5 = /*#__PURE__*/_createTextVNode(\" Join \");\n\nconst _hoisted_6 = /*#__PURE__*/_createTextVNode(\" Leave \");\n\nconst _hoisted_7 = /*#__PURE__*/_withScopeId(() => /*#__PURE__*/_createElementVNode(\"div\", {\n id: \"local\",\n style: {\n \"max-width\": \"640px\",\n \"margin-top\": \"20px\"\n }\n}, null, -1));\n\nconst _hoisted_8 = {\n class: \"remote-container\"\n};\nconst _hoisted_9 = [\"id\"];\nimport { useI18n } from 'vue-i18n';\nimport { ElMessage } from 'element-plus/es';\nimport { nextTick } from 'vue';\nimport { getParamKey } from '@/utils/utils';\nimport Client from '@/utils/client';\nimport appStore from '@/store';\nexport default /*#__PURE__*/_defineComponent({\n setup(__props) {\n const {\n t\n } = useI18n();\n const store = appStore();\n const sdkAppId = parseInt(getParamKey('sdkAppId'), 10);\n const userId = getParamKey('userId');\n const userSig = getParamKey('userSig');\n const roomId = parseInt(getParamKey('roomId'), 10);\n const state = {\n url: window.location.href.split('?')[0]\n };\n window.history.pushState(state, '', 'index.html#/invite');\n\n if (!sdkAppId || !userId || !userSig || !roomId) {\n ElMessage.error(t('check'));\n }\n\n let localClient;\n\n async function handleJoin() {\n try {\n localClient = new Client({\n sdkAppId,\n userSig,\n userId,\n roomId\n });\n const client = localClient.getClient();\n client.on('stream-subscribed', handleSubscribed);\n client.on('stream-removed', handleRemoved);\n await localClient.join();\n await localClient.publish();\n const localStream = localClient.getLocalStream();\n await nextTick();\n localStream.play('local');\n } catch (error) {\n ElMessage({\n message: error.message_,\n type: 'error'\n });\n }\n }\n\n async function handleSubscribed(event) {\n const remoteStream = event.stream;\n const id = remoteStream.getId();\n const remoteId = `${id}`;\n console.log(1212, event);\n store.invitedRemoteStreams.push(remoteStream);\n await nextTick();\n remoteStream.play(remoteId).then(() => {\n console.log(`RemoteStream play success: [${userId}]`);\n }).catch(error => {\n console.log(`RemoteStream play failed: [${userId}], error: ${error.message_}`);\n });\n }\n\n async function handleRemoved(event) {\n const remoteStream = event.stream;\n const id = remoteStream.getId();\n store.invitedRemoteStreams = store.invitedRemoteStreams.filter(stream => stream.getId() !== id);\n }\n\n async function handleLeave() {\n await localClient.leave();\n }\n\n return (_ctx, _cache) => {\n const _component_el_button = _resolveComponent(\"el-button\");\n\n const _component_el_col = _resolveComponent(\"el-col\");\n\n const _component_el_row = _resolveComponent(\"el-row\");\n\n return _openBlock(), _createBlock(_component_el_row, {\n style: {\n \"padding\": \"0 10px 40px 10px\"\n }\n }, {\n default: _withCtx(() => [_createVNode(_component_el_col, {\n md: {\n span: 18,\n offset: 3\n },\n sm: {\n span: 24\n }\n }, {\n default: _withCtx(() => [_createElementVNode(\"div\", _hoisted_1, [_createElementVNode(\"div\", _hoisted_2, [_createElementVNode(\"div\", _hoisted_3, _toDisplayString(_unref(t)('inviteUrl')), 1)])]), _createElementVNode(\"div\", _hoisted_4, [_createVNode(_component_el_button, {\n type: \"primary\",\n onClick: handleJoin\n }, {\n default: _withCtx(() => [_hoisted_5]),\n _: 1\n }), _createVNode(_component_el_button, {\n type: \"primary\",\n onClick: handleLeave\n }, {\n default: _withCtx(() => [_hoisted_6]),\n _: 1\n })]), _hoisted_7, _createElementVNode(\"div\", _hoisted_8, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(_unref(store).invitedRemoteStreams, item => {\n return _openBlock(), _createElementBlock(\"div\", {\n key: item.getId(),\n id: item.getId(),\n style: {\n \"max-width\": \"640px\",\n \"margin-top\": \"20px\"\n }\n }, null, 8, _hoisted_9);\n }), 128))])]),\n _: 1\n })]),\n _: 1\n });\n };\n }\n\n});","/* unplugin-vue-components disabled */import script from \"./Invite.vue?vue&type=script&lang=ts&setup=true\"\nexport * from \"./Invite.vue?vue&type=script&lang=ts&setup=true\"\n\nimport \"./Invite.vue?vue&type=style&index=0&id=ca3824de&lang=stylus&scoped=true\"\n\nimport exportComponent from \"D:\\\\demo\\\\onlineVideo\\\\Web\\\\quick-demo-vue3-ts\\\\node_modules\\\\vue-loader\\\\dist\\\\exportHelper.js\"\nconst __exports__ = /*#__PURE__*/exportComponent(script, [['__scopeId',\"data-v-ca3824de\"]])\n\nexport default __exports__"],"names":["LocalClient","constructor","options","sdkAppId","userId","roomId","secretKey","userSig","this","client","localStream","remoteStreams","isJoined","isPublished","cameraId","microphoneId","video","audio","initClient","genTestUserSig","TRTC","mode","console","log","installEventHandlers","e","createShareLink","String","Math","floor","random","origin","window","location","pathname","replace","setVideoProfile","initialize","message_","join","initLocalStream","error","warn","publish","unpublish","leave","stop","close","videoId","audioId","switchDevice","on","handleError","bind","handleBanned","handlePeerJoin","handlePeerLeave","handleStreamAdded","handleStreamUpdated","handleConnection","handleMuteVideo","handleMuteAudio","handleUnmuteVideo","handleUnmuteAudio","event","ElMessage","message","type","reason","remoteStream","stream","id","getId","getUserId","unsubscribe","catch","getType","subscribe","handleStreamSubscribed","push","handleStreamRemoved","filter","hasAudio","hasVideo","state","getClient","getLocalStream","_withScopeId","n","_hoisted_1","class","_hoisted_2","_hoisted_3","_hoisted_4","style","_hoisted_5","_hoisted_6","_hoisted_7","_","_hoisted_8","_hoisted_9","setup","__props","t","store","parseInt","url","href","split","localClient","async","handleJoin","handleSubscribed","handleRemoved","play","remoteId","invitedRemoteStreams","then","handleLeave","history","pushState","_ctx","_cache","_component_el_button","_component_el_col","_component_el_row","default","md","span","offset","sm","onClick","item","key","__exports__"],"sourceRoot":""}
|