@yimou6/common-ui 1.10.6 → 1.10.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/cdn/index.cdn.js +30 -17
  2. package/cdn/index.cdn.js.map +1 -1
  3. package/cdn/index.cdn.mjs +26 -13
  4. package/cdn/index.cdn.mjs.map +1 -1
  5. package/cdn/index.css +1 -1
  6. package/es/components/tenant-enterprise/src/tenant-enterprise.vue2.mjs +12 -3
  7. package/es/components/tenant-enterprise/src/tenant-enterprise.vue2.mjs.map +1 -1
  8. package/es/components/tzj-player/index.d.ts +5066 -3
  9. package/es/components/tzj-player/src/easyPlayer.vue.d.ts +103 -7
  10. package/es/components/tzj-player/src/easyPlayer.vue2.mjs +125 -21
  11. package/es/components/tzj-player/src/easyPlayer.vue2.mjs.map +1 -1
  12. package/es/components/tzj-player/src/tzj-player.d.ts +19 -2
  13. package/es/components/tzj-player/src/tzj-player.mjs +47 -1
  14. package/es/components/tzj-player/src/tzj-player.mjs.map +1 -1
  15. package/es/components/tzj-player/src/tzj-player.vue.d.ts +5066 -3
  16. package/es/components/tzj-player/src/tzj-player.vue2.mjs +129 -36
  17. package/es/components/tzj-player/src/tzj-player.vue2.mjs.map +1 -1
  18. package/es/components/tzj-player/src/ysPlayer.vue2.mjs +3 -2
  19. package/es/components/tzj-player/src/ysPlayer.vue2.mjs.map +1 -1
  20. package/es/components/tzj-player/src/yunzhiyan.d.ts +6 -0
  21. package/es/components/tzj-player/src/yunzhiyan.mjs +159 -0
  22. package/es/components/tzj-player/src/yunzhiyan.mjs.map +1 -0
  23. package/es/components/tzj-player/src/yunzhiyanPlayer.vue.d.ts +1519 -0
  24. package/es/components/tzj-player/src/yunzhiyanPlayer.vue.mjs +6 -0
  25. package/es/components/tzj-player/src/yunzhiyanPlayer.vue.mjs.map +1 -0
  26. package/es/components/tzj-player/src/yunzhiyanPlayer.vue2.mjs +630 -0
  27. package/es/components/tzj-player/src/yunzhiyanPlayer.vue2.mjs.map +1 -0
  28. package/es/utils/provide.d.ts +3 -3
  29. package/es/utils/provide.mjs.map +1 -1
  30. package/lib/components/tenant-enterprise/src/tenant-enterprise.vue2.js +12 -3
  31. package/lib/components/tenant-enterprise/src/tenant-enterprise.vue2.js.map +1 -1
  32. package/lib/components/tzj-player/index.d.ts +5066 -3
  33. package/lib/components/tzj-player/src/easyPlayer.vue.d.ts +103 -7
  34. package/lib/components/tzj-player/src/easyPlayer.vue2.js +123 -19
  35. package/lib/components/tzj-player/src/easyPlayer.vue2.js.map +1 -1
  36. package/lib/components/tzj-player/src/tzj-player.d.ts +19 -2
  37. package/lib/components/tzj-player/src/tzj-player.js +47 -0
  38. package/lib/components/tzj-player/src/tzj-player.js.map +1 -1
  39. package/lib/components/tzj-player/src/tzj-player.vue.d.ts +5066 -3
  40. package/lib/components/tzj-player/src/tzj-player.vue2.js +125 -32
  41. package/lib/components/tzj-player/src/tzj-player.vue2.js.map +1 -1
  42. package/lib/components/tzj-player/src/ysPlayer.vue2.js +3 -2
  43. package/lib/components/tzj-player/src/ysPlayer.vue2.js.map +1 -1
  44. package/lib/components/tzj-player/src/yunzhiyan.d.ts +6 -0
  45. package/lib/components/tzj-player/src/yunzhiyan.js +166 -0
  46. package/lib/components/tzj-player/src/yunzhiyan.js.map +1 -0
  47. package/lib/components/tzj-player/src/yunzhiyanPlayer.vue.d.ts +1519 -0
  48. package/lib/components/tzj-player/src/yunzhiyanPlayer.vue.js +10 -0
  49. package/lib/components/tzj-player/src/yunzhiyanPlayer.vue.js.map +1 -0
  50. package/lib/components/tzj-player/src/yunzhiyanPlayer.vue2.js +634 -0
  51. package/lib/components/tzj-player/src/yunzhiyanPlayer.vue2.js.map +1 -0
  52. package/lib/utils/provide.d.ts +3 -3
  53. package/lib/utils/provide.js.map +1 -1
  54. package/package.json +5 -3
  55. package/theme-default/i-tzj-player.css +1 -1
  56. package/theme-default/index.css +1 -1
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var yunzhiyanPlayer_vue_vue_type_script_setup_true_lang = require('./yunzhiyanPlayer.vue2.js');
6
+
7
+
8
+
9
+ exports.default = yunzhiyanPlayer_vue_vue_type_script_setup_true_lang.default;
10
+ //# sourceMappingURL=yunzhiyanPlayer.vue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"yunzhiyanPlayer.vue.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
@@ -0,0 +1,634 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var vue = require('vue');
6
+ require('./easyPlayer.vue.js');
7
+ var tzjPlayer = require('./tzj-player.js');
8
+ var yunzhiyan = require('./yunzhiyan.js');
9
+ var easyPlayer_vue_vue_type_script_setup_true_lang = require('./easyPlayer.vue2.js');
10
+
11
+ var __defProp = Object.defineProperty;
12
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
13
+ const _hoisted_1 = {
14
+ key: 0,
15
+ class: "i-tzj-player__error"
16
+ };
17
+ const _hoisted_2 = {
18
+ key: 0,
19
+ class: "i-easy-player-bar"
20
+ };
21
+ const _hoisted_3 = { class: "i-easy-player-bar-item i-easy-player-bar-left" };
22
+ const _hoisted_4 = {
23
+ key: 2,
24
+ class: "i-easy-player-bottom-bar"
25
+ };
26
+ const _hoisted_5 = {
27
+ key: 3,
28
+ class: "i-easy-player-bottom-bar"
29
+ };
30
+ const _hoisted_6 = { class: "i-easy-player-bar-item i-easy-player-bar-right" };
31
+ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
32
+ ...{
33
+ name: "YunzhiyanPlayer"
34
+ },
35
+ __name: "yunzhiyanPlayer",
36
+ props: tzjPlayer.TzjPlayerProps,
37
+ setup(__props) {
38
+ const props = __props;
39
+ const videoUrl = vue.ref("");
40
+ const errorMsg = vue.ref("");
41
+ const taskId = vue.ref("");
42
+ const showBottomBar = vue.ref(false);
43
+ const playerRef = vue.shallowRef();
44
+ const isPlaying = vue.ref(false);
45
+ const isVoice = vue.ref(false);
46
+ const isFullscreen = vue.ref(false);
47
+ const isVolumeMuted = vue.ref(true);
48
+ const isIntercomActive = vue.ref(false);
49
+ const audioContext = vue.ref(null);
50
+ const mediaStream = vue.ref(null);
51
+ const websocket = vue.ref(null);
52
+ const audioWorkletNode = vue.ref(null);
53
+ const intercomTimer = vue.ref(null);
54
+ const audioMsg = vue.ref({
55
+ type: "",
56
+ msg: ""
57
+ });
58
+ const AUDIO_CONFIG = {
59
+ sampleRate: 48e3,
60
+ channelCount: 1,
61
+ sampleSize: 16
62
+ };
63
+ const initPlayer = /* @__PURE__ */ __name(async () => {
64
+ try {
65
+ if (!props.deviceSerial) {
66
+ errorMsg.value = "\u8BBE\u5907\u5E8F\u5217\u53F7\u4E0D\u80FD\u4E3A\u7A7A";
67
+ return;
68
+ }
69
+ const channelId = await yunzhiyan.GetYunZhiYanDeviceChannel(props.deviceSerial);
70
+ if (props.debug) {
71
+ console.log("\u83B7\u53D6\u4E91\u667A\u773C\u8BBE\u5907\u901A\u9053ID", channelId);
72
+ }
73
+ if (!channelId) {
74
+ errorMsg.value = "\u83B7\u53D6\u8BBE\u5907\u901A\u9053ID\u5931\u8D25";
75
+ return;
76
+ }
77
+ const url = await yunzhiyan.GetYunZhiYanDeviceVideoUrl(props.deviceSerial, channelId);
78
+ if (props.debug) {
79
+ console.log("\u83B7\u53D6\u4E91\u667A\u773C\u8BBE\u5907\u89C6\u9891\u64AD\u653E\u5730\u5740", url);
80
+ }
81
+ if (!url) {
82
+ errorMsg.value = "\u83B7\u53D6\u89C6\u9891\u64AD\u653E\u5730\u5740\u5931\u8D25";
83
+ return;
84
+ }
85
+ videoUrl.value = url;
86
+ errorMsg.value = "";
87
+ } catch (error) {
88
+ if (props.debug) {
89
+ console.error("\u521D\u59CB\u5316\u4E91\u667A\u773C\u64AD\u653E\u5668\u5931\u8D25:", error);
90
+ }
91
+ errorMsg.value = `\u521D\u59CB\u5316\u5931\u8D25: ${error instanceof Error ? error.message : "\u672A\u77E5\u9519\u8BEF"}`;
92
+ }
93
+ }, "initPlayer");
94
+ const playerPlay = /* @__PURE__ */ __name(() => {
95
+ var _a;
96
+ (_a = playerRef.value) == null ? void 0 : _a.play();
97
+ }, "playerPlay");
98
+ const playerPause = /* @__PURE__ */ __name(() => {
99
+ var _a;
100
+ (_a = playerRef.value) == null ? void 0 : _a.pause();
101
+ }, "playerPause");
102
+ const playerScreenShot = /* @__PURE__ */ __name(() => {
103
+ var _a;
104
+ (_a = playerRef.value) == null ? void 0 : _a.screenshot();
105
+ }, "playerScreenShot");
106
+ const playerFullscreen = /* @__PURE__ */ __name((fullscreen) => {
107
+ var _a;
108
+ isFullscreen.value = fullscreen;
109
+ (_a = playerRef.value) == null ? void 0 : _a.fullscreen(fullscreen);
110
+ }, "playerFullscreen");
111
+ const getAudioUrl = /* @__PURE__ */ __name(async () => {
112
+ try {
113
+ if (!props.deviceSerial) {
114
+ throw new Error("\u8BBE\u5907\u5E8F\u5217\u53F7\u4E0D\u80FD\u4E3A\u7A7A");
115
+ }
116
+ const res = await yunzhiyan.GetYunZhiYanOpenVoiceIntercom(props.deviceSerial);
117
+ if (props.debug) {
118
+ console.log("\u5F00\u542F\u8BED\u97F3\u5BF9\u8BB2\u54CD\u5E94:", res);
119
+ }
120
+ if (!res) {
121
+ throw new Error("\u5F00\u542F\u8BED\u97F3\u5BF9\u8BB2\u5931\u8D25");
122
+ }
123
+ taskId.value = res.taskId;
124
+ const wssUrl = res.wssUrl;
125
+ if (!taskId.value || !wssUrl) {
126
+ throw new Error("\u83B7\u53D6\u8BED\u97F3\u5BF9\u8BB2\u53C2\u6570\u5931\u8D25");
127
+ }
128
+ const sign = await yunzhiyan.GetYunZhiYanUserPlaySecretKey(taskId.value);
129
+ if (!sign) {
130
+ throw new Error("\u83B7\u53D6\u7B7E\u540D\u5931\u8D25");
131
+ }
132
+ const url = new URL(wssUrl);
133
+ url.searchParams.append("sign", sign);
134
+ return url.toString();
135
+ } catch (error) {
136
+ if (props.debug) {
137
+ console.error("\u83B7\u53D6\u8BED\u97F3\u5BF9\u8BB2\u5730\u5740\u5931\u8D25:", error);
138
+ }
139
+ throw error;
140
+ }
141
+ }, "getAudioUrl");
142
+ const initAudioContext = /* @__PURE__ */ __name(async () => {
143
+ try {
144
+ audioContext.value = new (window.AudioContext || window.webkitAudioContext)({
145
+ sampleRate: AUDIO_CONFIG.sampleRate
146
+ });
147
+ if (audioContext.value.state === "suspended") {
148
+ await audioContext.value.resume();
149
+ }
150
+ if (props.debug) {
151
+ console.log(
152
+ "\u97F3\u9891\u4E0A\u4E0B\u6587\u521D\u59CB\u5316\u6210\u529F\uFF0C\u91C7\u6837\u7387:",
153
+ audioContext.value.sampleRate
154
+ );
155
+ }
156
+ } catch (error) {
157
+ throw new Error(`\u97F3\u9891\u4E0A\u4E0B\u6587\u521D\u59CB\u5316\u5931\u8D25: ${error}`);
158
+ }
159
+ }, "initAudioContext");
160
+ const initMicrophone = /* @__PURE__ */ __name(async () => {
161
+ try {
162
+ if (!navigator.mediaDevices || !navigator.mediaDevices.getUserMedia) {
163
+ throw new Error("\u5F53\u524D\u6D4F\u89C8\u5668\u4E0D\u652F\u6301\u9EA6\u514B\u98CE\u8BBF\u95EE");
164
+ }
165
+ const constraints = {
166
+ audio: {
167
+ channelCount: AUDIO_CONFIG.channelCount,
168
+ sampleRate: AUDIO_CONFIG.sampleRate,
169
+ echoCancellation: true,
170
+ noiseSuppression: true,
171
+ autoGainControl: true
172
+ },
173
+ video: false
174
+ };
175
+ mediaStream.value = await navigator.mediaDevices.getUserMedia(constraints);
176
+ if (props.debug) {
177
+ console.log("\u9EA6\u514B\u98CE\u521D\u59CB\u5316\u6210\u529F");
178
+ }
179
+ } catch (error) {
180
+ if (error instanceof Error) {
181
+ switch (error.name) {
182
+ case "NotAllowedError":
183
+ throw new Error("\u9EA6\u514B\u98CE\u6743\u9650\u88AB\u62D2\u7EDD\uFF0C\u8BF7\u5141\u8BB8\u8BBF\u95EE\u9EA6\u514B\u98CE");
184
+ case "NotFoundError":
185
+ throw new Error("\u672A\u627E\u5230\u53EF\u7528\u7684\u9EA6\u514B\u98CE\u8BBE\u5907");
186
+ case "NotReadableError":
187
+ throw new Error("\u9EA6\u514B\u98CE\u8BBE\u5907\u88AB\u5176\u4ED6\u5E94\u7528\u5360\u7528");
188
+ case "OverconstrainedError":
189
+ throw new Error("\u9EA6\u514B\u98CE\u8BBE\u5907\u4E0D\u652F\u6301\u6307\u5B9A\u7684\u97F3\u9891\u53C2\u6570");
190
+ default:
191
+ throw new Error(`\u9EA6\u514B\u98CE\u521D\u59CB\u5316\u5931\u8D25: ${error.message}`);
192
+ }
193
+ }
194
+ throw new Error(`\u9EA6\u514B\u98CE\u521D\u59CB\u5316\u5931\u8D25: ${error}`);
195
+ }
196
+ }, "initMicrophone");
197
+ const connectWebSocket = /* @__PURE__ */ __name(async (url) => {
198
+ return new Promise((resolve, reject) => {
199
+ try {
200
+ websocket.value = new WebSocket(url);
201
+ websocket.value.binaryType = "arraybuffer";
202
+ let isResolved = false;
203
+ websocket.value.onopen = () => {
204
+ if (props.debug) {
205
+ console.log("WebSocket\u8FDE\u63A5\u6210\u529F");
206
+ }
207
+ if (!isResolved) {
208
+ isResolved = true;
209
+ resolve();
210
+ }
211
+ };
212
+ websocket.value.onerror = (error) => {
213
+ if (props.debug) {
214
+ console.error("WebSocket\u8FDE\u63A5\u9519\u8BEF:", error);
215
+ }
216
+ if (!isResolved) {
217
+ isResolved = true;
218
+ reject(new Error("WebSocket\u8FDE\u63A5\u5931\u8D25"));
219
+ }
220
+ };
221
+ websocket.value.onclose = (event) => {
222
+ if (props.debug) {
223
+ console.log("WebSocket\u8FDE\u63A5\u5173\u95ED:", event.code, event.reason);
224
+ }
225
+ if (isIntercomActive.value) {
226
+ isIntercomActive.value = false;
227
+ isVoice.value = false;
228
+ }
229
+ };
230
+ websocket.value.onmessage = (event) => {
231
+ if (props.debug) {
232
+ console.log("\u6536\u5230\u670D\u52A1\u7AEF\u6D88\u606F:", event.data);
233
+ }
234
+ };
235
+ const timeoutId = setTimeout(() => {
236
+ var _a, _b;
237
+ if (!isResolved && ((_a = websocket.value) == null ? void 0 : _a.readyState) !== WebSocket.OPEN) {
238
+ isResolved = true;
239
+ (_b = websocket.value) == null ? void 0 : _b.close();
240
+ reject(new Error("WebSocket\u8FDE\u63A5\u8D85\u65F6"));
241
+ }
242
+ }, 1e4);
243
+ if (websocket.value) {
244
+ const originalOnOpen = websocket.value.onopen;
245
+ const originalOnError = websocket.value.onerror;
246
+ websocket.value.onopen = function(event) {
247
+ clearTimeout(timeoutId);
248
+ originalOnOpen == null ? void 0 : originalOnOpen.call(this, event);
249
+ };
250
+ websocket.value.onerror = function(event) {
251
+ clearTimeout(timeoutId);
252
+ originalOnError == null ? void 0 : originalOnError.call(this, event);
253
+ };
254
+ }
255
+ } catch (error) {
256
+ reject(new Error(`WebSocket\u521B\u5EFA\u5931\u8D25: ${error}`));
257
+ }
258
+ });
259
+ }, "connectWebSocket");
260
+ const convertToPCM16 = /* @__PURE__ */ __name((float32Array) => {
261
+ const buffer = new ArrayBuffer(float32Array.length * 2);
262
+ const view = new DataView(buffer);
263
+ for (let i = 0; i < float32Array.length; i++) {
264
+ const sample = Math.max(-1, Math.min(1, float32Array[i]));
265
+ const intSample = sample < 0 ? sample * 32768 : sample * 32767;
266
+ view.setInt16(i * 2, intSample, true);
267
+ }
268
+ return buffer;
269
+ }, "convertToPCM16");
270
+ const startAudioProcessing = /* @__PURE__ */ __name(async () => {
271
+ try {
272
+ if (!audioContext.value || !mediaStream.value) {
273
+ throw new Error("\u97F3\u9891\u4E0A\u4E0B\u6587\u6216\u5A92\u4F53\u6D41\u672A\u521D\u59CB\u5316");
274
+ }
275
+ const sourceNode = audioContext.value.createMediaStreamSource(
276
+ mediaStream.value
277
+ );
278
+ const bufferSize = 4096;
279
+ const processor = audioContext.value.createScriptProcessor(
280
+ bufferSize,
281
+ 1,
282
+ 1
283
+ );
284
+ processor.onaudioprocess = (event) => {
285
+ if (!isIntercomActive.value || !websocket.value || websocket.value.readyState !== WebSocket.OPEN) {
286
+ return;
287
+ }
288
+ try {
289
+ const inputBuffer = event.inputBuffer;
290
+ const inputData = inputBuffer.getChannelData(0);
291
+ if (inputData.length === 0) {
292
+ return;
293
+ }
294
+ const pcmData = convertToPCM16(inputData);
295
+ websocket.value.send(pcmData);
296
+ } catch (error) {
297
+ if (props.debug) {
298
+ console.error("\u97F3\u9891\u6570\u636E\u5904\u7406\u9519\u8BEF:", error);
299
+ }
300
+ }
301
+ };
302
+ sourceNode.connect(processor);
303
+ processor.connect(audioContext.value.destination);
304
+ audioWorkletNode.value = processor;
305
+ if (props.debug) {
306
+ console.log("\u97F3\u9891\u6570\u636E\u5904\u7406\u5F00\u59CB");
307
+ }
308
+ } catch (error) {
309
+ throw new Error(`\u97F3\u9891\u6570\u636E\u5904\u7406\u542F\u52A8\u5931\u8D25: ${error}`);
310
+ }
311
+ }, "startAudioProcessing");
312
+ const stopIntercom = /* @__PURE__ */ __name(async () => {
313
+ try {
314
+ if (props.debug) {
315
+ console.log("\u6B63\u5728\u505C\u6B62\u8BED\u97F3\u5BF9\u8BB2...");
316
+ }
317
+ isVoice.value = false;
318
+ isIntercomActive.value = false;
319
+ if (intercomTimer.value) {
320
+ clearTimeout(intercomTimer.value);
321
+ intercomTimer.value = null;
322
+ }
323
+ if (props.deviceSerial && taskId.value) {
324
+ try {
325
+ await yunzhiyan.GetYunZhiYanCloseVoiceIntercom(props.deviceSerial, taskId.value);
326
+ } catch (error) {
327
+ if (props.debug) {
328
+ console.error("\u5173\u95ED\u670D\u52A1\u7AEF\u8BED\u97F3\u5BF9\u8BB2\u5931\u8D25:", error);
329
+ }
330
+ }
331
+ }
332
+ if (websocket.value) {
333
+ if (websocket.value.readyState === WebSocket.OPEN) {
334
+ websocket.value.close(1e3, "\u7528\u6237\u4E3B\u52A8\u5173\u95ED");
335
+ }
336
+ websocket.value = null;
337
+ }
338
+ if (mediaStream.value) {
339
+ mediaStream.value.getTracks().forEach((track) => {
340
+ track.stop();
341
+ });
342
+ mediaStream.value = null;
343
+ }
344
+ if (audioContext.value && audioContext.value.state !== "closed") {
345
+ try {
346
+ await audioContext.value.close();
347
+ } catch (error) {
348
+ if (props.debug) {
349
+ console.error("\u5173\u95ED\u97F3\u9891\u4E0A\u4E0B\u6587\u5931\u8D25:", error);
350
+ }
351
+ }
352
+ audioContext.value = null;
353
+ }
354
+ if (audioWorkletNode.value) {
355
+ try {
356
+ audioWorkletNode.value.disconnect();
357
+ } catch (error) {
358
+ if (props.debug) {
359
+ console.error("\u65AD\u5F00\u97F3\u9891\u5DE5\u4F5C\u8282\u70B9\u5931\u8D25:", error);
360
+ }
361
+ }
362
+ audioWorkletNode.value = null;
363
+ }
364
+ taskId.value = "";
365
+ audioMsg.value = {
366
+ type: "",
367
+ msg: ""
368
+ };
369
+ if (props.debug) {
370
+ console.log("\u8BED\u97F3\u5BF9\u8BB2\u5DF2\u505C\u6B62");
371
+ }
372
+ } catch (error) {
373
+ if (props.debug) {
374
+ console.error("\u505C\u6B62\u8BED\u97F3\u5BF9\u8BB2\u65F6\u53D1\u751F\u9519\u8BEF:", error);
375
+ }
376
+ }
377
+ }, "stopIntercom");
378
+ const handleVideoInfo = /* @__PURE__ */ __name(() => {
379
+ var _a;
380
+ isVolumeMuted.value = (_a = playerRef.value) == null ? void 0 : _a.isMute();
381
+ }, "handleVideoInfo");
382
+ const handleMute = /* @__PURE__ */ __name((mute) => {
383
+ isVolumeMuted.value = mute;
384
+ }, "handleMute");
385
+ const handleSetMute = /* @__PURE__ */ __name((volume) => {
386
+ var _a;
387
+ (_a = playerRef.value) == null ? void 0 : _a.setMute(volume);
388
+ }, "handleSetMute");
389
+ const intercom = /* @__PURE__ */ __name(async () => {
390
+ try {
391
+ if (props.debug) {
392
+ console.log("\u5F00\u59CB\u8BED\u97F3\u5BF9\u8BB2...");
393
+ }
394
+ audioMsg.value = {
395
+ type: "info",
396
+ msg: "\u6B63\u5728\u8FDE\u63A5..."
397
+ };
398
+ if (isIntercomActive.value) {
399
+ if (props.debug) {
400
+ console.warn("\u8BED\u97F3\u5BF9\u8BB2\u5DF2\u5728\u8FDB\u884C\u4E2D");
401
+ }
402
+ return;
403
+ }
404
+ isVoice.value = true;
405
+ if (props.debug) {
406
+ console.log("\u6B63\u5728\u83B7\u53D6\u8BED\u97F3\u63A8\u9001\u5730\u5740...");
407
+ }
408
+ const audioUrl = await getAudioUrl();
409
+ if (props.debug) {
410
+ console.log("\u8BED\u97F3\u63A8\u9001\u5730\u5740:", audioUrl);
411
+ }
412
+ await initAudioContext();
413
+ await initMicrophone();
414
+ await connectWebSocket(audioUrl);
415
+ await startAudioProcessing();
416
+ isIntercomActive.value = true;
417
+ if (isVolumeMuted.value) {
418
+ handleSetMute(0);
419
+ }
420
+ audioMsg.value = {
421
+ type: "success",
422
+ msg: "\u8BED\u97F3\u5BF9\u8BB2..."
423
+ };
424
+ intercomTimer.value = window.setTimeout(async () => {
425
+ if (props.debug) {
426
+ console.log("\u8BED\u97F3\u5BF9\u8BB230\u79D2\u65F6\u95F4\u5230\uFF0C\u81EA\u52A8\u505C\u6B62");
427
+ }
428
+ await stopIntercom();
429
+ }, 3e4);
430
+ if (props.debug) {
431
+ console.log("\u8BED\u97F3\u5BF9\u8BB2\u542F\u52A8\u6210\u529F");
432
+ }
433
+ } catch (error) {
434
+ if (props.debug) {
435
+ console.error("\u8BED\u97F3\u5BF9\u8BB2\u542F\u52A8\u5931\u8D25:", error);
436
+ }
437
+ await stopIntercom();
438
+ audioMsg.value = {
439
+ type: "error",
440
+ msg: "\u8BED\u97F3\u5BF9\u8BB2\u542F\u52A8\u5931\u8D25"
441
+ };
442
+ setTimeout(() => {
443
+ audioMsg.value = {
444
+ type: "",
445
+ msg: ""
446
+ };
447
+ }, 3e3);
448
+ }
449
+ }, "intercom");
450
+ vue.onMounted(() => {
451
+ initPlayer();
452
+ });
453
+ vue.onUnmounted(() => {
454
+ if (isIntercomActive.value) {
455
+ stopIntercom();
456
+ }
457
+ });
458
+ return (_ctx, _cache) => {
459
+ return vue.openBlock(), vue.createElementBlock(
460
+ vue.Fragment,
461
+ null,
462
+ [
463
+ errorMsg.value ? (vue.openBlock(), vue.createElementBlock(
464
+ "div",
465
+ _hoisted_1,
466
+ vue.toDisplayString(errorMsg.value),
467
+ 1
468
+ /* TEXT */
469
+ )) : videoUrl.value ? (vue.openBlock(), vue.createBlock(easyPlayer_vue_vue_type_script_setup_true_lang.default, {
470
+ key: 1,
471
+ ref_key: "playerRef",
472
+ ref: playerRef,
473
+ url: videoUrl.value,
474
+ debug: _ctx.debug,
475
+ "access-token": _ctx.accessToken,
476
+ "platform-type-name": _ctx.platformTypeName,
477
+ "device-serial": _ctx.deviceSerial,
478
+ onMouseenter: _cache[4] || (_cache[4] = ($event) => showBottomBar.value = true),
479
+ onMouseleave: _cache[5] || (_cache[5] = ($event) => showBottomBar.value = false),
480
+ onPause: _cache[6] || (_cache[6] = ($event) => isPlaying.value = false),
481
+ onPlay: _cache[7] || (_cache[7] = ($event) => isPlaying.value = true),
482
+ onVideoInfo: handleVideoInfo,
483
+ onMute: handleMute
484
+ }, {
485
+ customBar: vue.withCtx(() => [
486
+ showBottomBar.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2, [
487
+ vue.createCommentVNode(" \u5DE6\u4FA7\uFF1A\u64AD\u653E/\u6682\u505C "),
488
+ vue.createElementVNode("div", _hoisted_3, [
489
+ vue.createCommentVNode(" \u64AD\u653E "),
490
+ !isPlaying.value ? (vue.openBlock(), vue.createElementBlock("div", {
491
+ key: 0,
492
+ class: "i-easy-player-bottom-bar",
493
+ onClick: playerPlay
494
+ }, _cache[8] || (_cache[8] = [
495
+ vue.createElementVNode(
496
+ "i",
497
+ { class: "iconfont icon-playfill" },
498
+ null,
499
+ -1
500
+ /* CACHED */
501
+ )
502
+ ]))) : (vue.openBlock(), vue.createElementBlock(
503
+ vue.Fragment,
504
+ { key: 1 },
505
+ [
506
+ vue.createCommentVNode(" \u6682\u505C "),
507
+ vue.createElementVNode("div", {
508
+ class: "i-easy-player-bottom-bar",
509
+ onClick: playerPause
510
+ }, _cache[9] || (_cache[9] = [
511
+ vue.createElementVNode(
512
+ "i",
513
+ { class: "iconfont icon-stop" },
514
+ null,
515
+ -1
516
+ /* CACHED */
517
+ )
518
+ ]))
519
+ ],
520
+ 2112
521
+ /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
522
+ )),
523
+ !isVolumeMuted.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4, [
524
+ vue.createCommentVNode(" \u97F3\u91CF\u56FE\u6807 "),
525
+ vue.createElementVNode("i", {
526
+ class: "iconfont icon-notificationfill",
527
+ onClick: _cache[0] || (_cache[0] = ($event) => handleSetMute(1))
528
+ })
529
+ ])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_5, [
530
+ vue.createCommentVNode(" \u9759\u97F3\u56FE\u6807 "),
531
+ vue.createElementVNode("i", {
532
+ class: "iconfont icon-notificationforbidfill",
533
+ onClick: _cache[1] || (_cache[1] = ($event) => handleSetMute(0))
534
+ })
535
+ ]))
536
+ ]),
537
+ vue.createCommentVNode(" \u622A\u56FE,\u5168\u5C4F "),
538
+ vue.createElementVNode("div", _hoisted_6, [
539
+ vue.createCommentVNode(" \u8BED\u97F3\u5BF9\u8BB2:\u5173\u95ED\u72B6\u6001 "),
540
+ !isVoice.value ? (vue.openBlock(), vue.createElementBlock("div", {
541
+ key: 0,
542
+ class: "i-easy-player-bottom-bar",
543
+ onClick: intercom
544
+ }, _cache[10] || (_cache[10] = [
545
+ vue.createElementVNode(
546
+ "i",
547
+ { class: "iconfont icon-voice" },
548
+ null,
549
+ -1
550
+ /* CACHED */
551
+ )
552
+ ]))) : vue.createCommentVNode("v-if", true),
553
+ vue.createCommentVNode(" \u8BED\u97F3\u5BF9\u8BB2:\u5F00\u542F\u72B6\u6001 "),
554
+ isVoice.value ? (vue.openBlock(), vue.createElementBlock("div", {
555
+ key: 1,
556
+ class: "i-easy-player-bottom-bar",
557
+ onClick: stopIntercom
558
+ }, _cache[11] || (_cache[11] = [
559
+ vue.createElementVNode(
560
+ "i",
561
+ { class: "iconfont icon-voicefill" },
562
+ null,
563
+ -1
564
+ /* CACHED */
565
+ )
566
+ ]))) : vue.createCommentVNode("v-if", true),
567
+ vue.createCommentVNode(" \u622A\u56FE "),
568
+ vue.createElementVNode("div", {
569
+ class: "i-easy-player-bottom-bar",
570
+ onClick: playerScreenShot
571
+ }, _cache[12] || (_cache[12] = [
572
+ vue.createElementVNode(
573
+ "i",
574
+ { class: "iconfont icon-picfill" },
575
+ null,
576
+ -1
577
+ /* CACHED */
578
+ )
579
+ ])),
580
+ vue.createCommentVNode(" \u5168\u5C4F "),
581
+ !isFullscreen.value ? (vue.openBlock(), vue.createElementBlock("div", {
582
+ key: 2,
583
+ class: "i-easy-player-bottom-bar",
584
+ onClick: _cache[2] || (_cache[2] = ($event) => playerFullscreen(true))
585
+ }, _cache[13] || (_cache[13] = [
586
+ vue.createElementVNode(
587
+ "i",
588
+ { class: "iconfont icon-full" },
589
+ null,
590
+ -1
591
+ /* CACHED */
592
+ )
593
+ ]))) : vue.createCommentVNode("v-if", true),
594
+ vue.createCommentVNode(" \u53D6\u6D88\u5168\u5C4F "),
595
+ isFullscreen.value ? (vue.openBlock(), vue.createElementBlock("div", {
596
+ key: 3,
597
+ class: "i-easy-player-bottom-bar",
598
+ onClick: _cache[3] || (_cache[3] = ($event) => playerFullscreen(false))
599
+ }, _cache[14] || (_cache[14] = [
600
+ vue.createElementVNode(
601
+ "i",
602
+ { class: "iconfont icon-reduction" },
603
+ null,
604
+ -1
605
+ /* CACHED */
606
+ )
607
+ ]))) : vue.createCommentVNode("v-if", true)
608
+ ])
609
+ ])) : vue.createCommentVNode("v-if", true)
610
+ ]),
611
+ _: 1
612
+ /* STABLE */
613
+ }, 8, ["url", "debug", "access-token", "platform-type-name", "device-serial"])) : vue.createCommentVNode("v-if", true),
614
+ vue.createCommentVNode(" \u8BED\u97F3\u5BF9\u8BB2\u9519\u8BEF\u63D0\u793A "),
615
+ audioMsg.value.msg ? (vue.openBlock(), vue.createElementBlock(
616
+ "div",
617
+ {
618
+ key: 2,
619
+ class: vue.normalizeClass(["i-tzj-player__voice-default", `i-tzj-player__voice-${audioMsg.value.type}`])
620
+ },
621
+ vue.toDisplayString(audioMsg.value.msg),
622
+ 3
623
+ /* TEXT, CLASS */
624
+ )) : vue.createCommentVNode("v-if", true)
625
+ ],
626
+ 64
627
+ /* STABLE_FRAGMENT */
628
+ );
629
+ };
630
+ }
631
+ });
632
+
633
+ exports.default = _sfc_main;
634
+ //# sourceMappingURL=yunzhiyanPlayer.vue2.js.map