@vunk/plus 1.3.5 → 1.3.7

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.
@@ -3403,6 +3403,14 @@ var _sfc_main$4 = /* @__PURE__ */ defineComponent({
3403
3403
  }
3404
3404
  });
3405
3405
 
3406
+ const originalPlay = howler.Howl.prototype.play;
3407
+ howler.Howl.prototype.play = function (soundId) {
3408
+ const WeixinJSBridge = window.WeixinJSBridge;
3409
+ WeixinJSBridge && WeixinJSBridge.invoke("getNetworkType", {}, () => {
3410
+ originalPlay.call(this, soundId);
3411
+ }, false);
3412
+ return originalPlay.call(this, soundId);
3413
+ };
3406
3414
  var _sfc_main$3 = /* @__PURE__ */ defineComponent({
3407
3415
  components: {
3408
3416
  SpeechError: _sfc_main$4
@@ -3448,8 +3456,6 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
3448
3456
  }
3449
3457
  return new howler.Howl({
3450
3458
  src: [url],
3451
- html5: true,
3452
- // 使用HTML5 Audio,对于流媒体很重要
3453
3459
  format: ["mp3", "wav", "aac"],
3454
3460
  // 事件处理
3455
3461
  onplay: () => {
@@ -3460,6 +3466,12 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
3460
3466
  },
3461
3467
  onend: () => {
3462
3468
  theData.value.broadcast = Broadcast.ended;
3469
+ setTimeout(() => {
3470
+ if (sound.value) {
3471
+ sound.value.unload();
3472
+ sound.value = null;
3473
+ }
3474
+ }, 400);
3463
3475
  props.deferred.resolve(true);
3464
3476
  },
3465
3477
  onloaderror: (_, error) => {
@@ -3468,6 +3480,7 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
3468
3480
  },
3469
3481
  onplayerror: (_, error) => {
3470
3482
  theData.value.broadcast = Broadcast.failed;
3483
+ console.error("Failed to play audio", error);
3471
3484
  props.deferred.reject(error || new Error("Failed to play audio"));
3472
3485
  }
3473
3486
  });
@@ -1,6 +1,6 @@
1
1
  import { useRecorder } from '@vunk/plus/composables/recorder';
2
2
  import { ElButton, ElMessage } from 'element-plus';
3
- import { defineComponent, ref, onUnmounted, resolveComponent, createElementBlock, openBlock, createCommentVNode, createBlock, createVNode, Teleport, createElementVNode, toDisplayString, normalizeClass, mergeProps, withCtx } from 'vue';
3
+ import { defineComponent, ref, onUnmounted, resolveComponent, createElementBlock, openBlock, createCommentVNode, createBlock, createVNode, Teleport, withDirectives, createElementVNode, toDisplayString, normalizeClass, vShow, mergeProps, withCtx } from 'vue';
4
4
  import 'recorder-core/src/engine/mp3';
5
5
  import 'recorder-core/src/engine/wav';
6
6
  import 'recorder-core/src/engine/mp3-engine';
@@ -91,6 +91,7 @@ var _sfc_main = defineComponent({
91
91
  });
92
92
  } catch (e) {
93
93
  ElMessage.error(`\u5F55\u97F3\u5931\u8D25:${e}`);
94
+ isDragging.value = false;
94
95
  return;
95
96
  }
96
97
  recording.value = true;
@@ -163,8 +164,8 @@ var _sfc_main = defineComponent({
163
164
  return;
164
165
  const touch = "touches" in e ? e.touches[0] : e;
165
166
  dragPosition.value = { x: touch.clientX, y: touch.clientY };
166
- const cancelBtn = document.querySelector(".cancel-btn");
167
- const textBtn = document.querySelector(".text-btn");
167
+ const cancelBtn = document.querySelector(".cancel-btn-x");
168
+ const textBtn = document.querySelector(".text-btn-x");
168
169
  if (cancelBtn && textBtn) {
169
170
  const cancelRect = cancelBtn.getBoundingClientRect();
170
171
  const textRect = textBtn.getBoundingClientRect();
@@ -214,10 +215,7 @@ var _sfc_main = defineComponent({
214
215
  });
215
216
 
216
217
  const _hoisted_1 = { class: "vk-recorder-container" };
217
- const _hoisted_2 = {
218
- key: 0,
219
- class: "vk-recording-mask"
220
- };
218
+ const _hoisted_2 = { class: "vk-recording-mask" };
221
219
  const _hoisted_3 = { class: "recording-tip" };
222
220
  const _hoisted_4 = {
223
221
  ref: "recordingNode",
@@ -225,80 +223,94 @@ const _hoisted_4 = {
225
223
  };
226
224
  const _hoisted_5 = { class: "tip-text" };
227
225
  const _hoisted_6 = { class: "action-buttons" };
226
+ const _hoisted_7 = { class: "cancel-btn-x" };
227
+ const _hoisted_8 = { class: "text-btn-x" };
228
228
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
229
229
  const _component_ElButton = resolveComponent("ElButton");
230
230
  return openBlock(), createElementBlock("div", _hoisted_1, [
231
231
  createCommentVNode(" \u906E\u7F69\u5C42 "),
232
232
  (openBlock(), createBlock(Teleport, { to: _ctx.appendTo }, [
233
- _ctx.isDragging ? (openBlock(), createElementBlock("div", _hoisted_2, [
234
- createCommentVNode(" \u5F55\u97F3\u63D0\u793A\u533A\u57DF\u79FB\u5230\u4E0A\u9762 "),
235
- createElementVNode("div", _hoisted_3, [
236
- createElementVNode(
237
- "div",
238
- _hoisted_4,
239
- null,
240
- 512
241
- /* NEED_PATCH */
242
- ),
243
- createElementVNode(
244
- "div",
245
- _hoisted_5,
246
- toDisplayString(_ctx.cancelZone ? "\u677E\u5F00\u624B\u6307\uFF0C\u53D6\u6D88\u53D1\u9001" : "\u677E\u5F00\u53D1\u9001\uFF0C\u4E0A\u6ED1\u53D6\u6D88"),
247
- 1
248
- /* TEXT */
249
- )
250
- ]),
251
- createElementVNode("div", _hoisted_6, [
252
- createElementVNode(
253
- "div",
254
- {
255
- class: normalizeClass(["cancel-btn", { active: _ctx.cancelZone }])
256
- },
257
- _cache[0] || (_cache[0] = [
258
- createElementVNode(
259
- "div",
260
- { class: "btn-icon" },
261
- " \xD7 ",
262
- -1
263
- /* HOISTED */
264
- ),
233
+ withDirectives(createElementVNode(
234
+ "div",
235
+ _hoisted_2,
236
+ [
237
+ createCommentVNode(" \u5F55\u97F3\u63D0\u793A\u533A\u57DF\u79FB\u5230\u4E0A\u9762 "),
238
+ createElementVNode("div", _hoisted_3, [
239
+ createElementVNode(
240
+ "div",
241
+ _hoisted_4,
242
+ null,
243
+ 512
244
+ /* NEED_PATCH */
245
+ ),
246
+ createElementVNode(
247
+ "div",
248
+ _hoisted_5,
249
+ toDisplayString(_ctx.cancelZone ? "\u677E\u5F00\u624B\u6307\uFF0C\u53D6\u6D88\u53D1\u9001" : "\u677E\u5F00\u53D1\u9001\uFF0C\u4E0A\u6ED1\u53D6\u6D88"),
250
+ 1
251
+ /* TEXT */
252
+ )
253
+ ]),
254
+ createElementVNode("div", _hoisted_6, [
255
+ createElementVNode("div", _hoisted_7, [
265
256
  createElementVNode(
266
257
  "div",
267
- { class: "btn-text" },
268
- " \u53D6\u6D88\u53D1\u9001 ",
269
- -1
270
- /* HOISTED */
258
+ {
259
+ class: normalizeClass(["cancel-btn", { active: _ctx.cancelZone }])
260
+ },
261
+ _cache[0] || (_cache[0] = [
262
+ createElementVNode(
263
+ "div",
264
+ { class: "btn-icon" },
265
+ " \xD7 ",
266
+ -1
267
+ /* HOISTED */
268
+ ),
269
+ createElementVNode(
270
+ "div",
271
+ { class: "btn-text" },
272
+ " \u53D6\u6D88\u53D1\u9001 ",
273
+ -1
274
+ /* HOISTED */
275
+ )
276
+ ]),
277
+ 2
278
+ /* CLASS */
271
279
  )
272
280
  ]),
273
- 2
274
- /* CLASS */
275
- ),
276
- createElementVNode(
277
- "div",
278
- {
279
- class: normalizeClass(["text-btn", { active: _ctx.isTextZone }])
280
- },
281
- _cache[1] || (_cache[1] = [
281
+ createElementVNode("div", _hoisted_8, [
282
282
  createElementVNode(
283
283
  "div",
284
- { class: "btn-icon" },
285
- " \u6587 ",
286
- -1
287
- /* HOISTED */
288
- ),
289
- createElementVNode(
290
- "div",
291
- { class: "btn-text" },
292
- " \u8F6C\u4E3A\u6587\u5B57 ",
293
- -1
294
- /* HOISTED */
284
+ {
285
+ class: normalizeClass(["text-btn", { active: _ctx.isTextZone }])
286
+ },
287
+ _cache[1] || (_cache[1] = [
288
+ createElementVNode(
289
+ "div",
290
+ { class: "btn-icon" },
291
+ " \u6587 ",
292
+ -1
293
+ /* HOISTED */
294
+ ),
295
+ createElementVNode(
296
+ "div",
297
+ { class: "btn-text" },
298
+ " \u8F6C\u4E3A\u6587\u5B57 ",
299
+ -1
300
+ /* HOISTED */
301
+ )
302
+ ]),
303
+ 2
304
+ /* CLASS */
295
305
  )
296
- ]),
297
- 2
298
- /* CLASS */
299
- )
300
- ])
301
- ])) : createCommentVNode("v-if", true)
306
+ ])
307
+ ])
308
+ ],
309
+ 512
310
+ /* NEED_PATCH */
311
+ ), [
312
+ [vShow, _ctx.isDragging]
313
+ ])
302
314
  ], 8, ["to"])),
303
315
  createCommentVNode(" \u5F55\u97F3\u6309\u94AE "),
304
316
  createVNode(_component_ElButton, mergeProps(_ctx.$attrs, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vunk/plus",
3
- "version": "1.3.5",
3
+ "version": "1.3.7",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "license": "ISC",