@94ai/nf-audio 3.3.61 → 3.3.63

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.
@@ -60,6 +60,10 @@ const _sfc_main = {
60
60
  type: Number,
61
61
  default: 0
62
62
  },
63
+ showJumpTime: {
64
+ type: Boolean,
65
+ default: true
66
+ },
63
67
  // 快退秒数
64
68
  backSecond: {
65
69
  type: Number,
@@ -271,32 +275,34 @@ const _sfc_main = {
271
275
  }
272
276
  },
273
277
  async startAudioCtx() {
274
- if (!this.audioCtx) {
275
- this.audioCtx = new (window.AudioContext || window.webkitAudioContext)();
276
- this.audioSource = this.audioCtx.createMediaElementSource(this.audio);
277
- await this.audioCtx.audioWorklet.addModule("data:application/javascript," + encodeURIComponent(this.audioWorkletProcessor));
278
- this.processor = new AudioWorkletNode(this.audioCtx, "tick");
279
- this.audioSource.connect(this.processor).connect(this.audioCtx.destination);
280
- this.processor.port.onmessage = (event) => {
281
- if (event.data.command === "tick") {
282
- if (this.betweenPlaying) {
283
- if (this.betweenStart && this.betweenEnd) {
284
- if (this.debuglog) {
285
- console.log(this.audio.currentTime);
286
- }
287
- if (this.audio.currentTime >= this.betweenEnd) {
288
- this.pause();
278
+ if (window.location.protocol == "https:" || window.location.hostname === "localhost") {
279
+ if (!this.audioCtx) {
280
+ this.audioCtx = new (window.AudioContext || window.webkitAudioContext)();
281
+ this.audioSource = this.audioCtx.createMediaElementSource(this.audio);
282
+ await this.audioCtx.audioWorklet.addModule("data:application/javascript," + encodeURIComponent(this.audioWorkletProcessor));
283
+ this.processor = new AudioWorkletNode(this.audioCtx, "tick");
284
+ this.audioSource.connect(this.processor).connect(this.audioCtx.destination);
285
+ this.processor.port.onmessage = (event) => {
286
+ if (event.data.command === "tick") {
287
+ if (this.betweenPlaying) {
288
+ if (this.betweenEnd) {
289
+ if (this.debuglog) {
290
+ console.log(this.audio.currentTime);
291
+ }
292
+ if (this.audio.currentTime >= this.betweenEnd) {
293
+ this.pause();
294
+ }
289
295
  }
290
296
  }
291
297
  }
292
- }
293
- };
294
- } else {
295
- this.audioCtx.resume();
298
+ };
299
+ } else {
300
+ this.audioCtx.resume();
301
+ }
302
+ this.processor.port.postMessage({
303
+ command: "start"
304
+ });
296
305
  }
297
- this.processor.port.postMessage({
298
- command: "start"
299
- });
300
306
  },
301
307
  pause() {
302
308
  this.pauseAudio();
@@ -332,6 +338,16 @@ const _sfc_main = {
332
338
  this.$refs.progressCurrent.style.width = MoveX + "px";
333
339
  this.$refs.progressBar.style.left = MoveX - this.$refs.progressBar.clientWidth / 2 + "px";
334
340
  this.paused = false;
341
+ if (window.location.protocol == "http:" && window.location.hostname !== "localhost" && this.betweenPlaying) {
342
+ if (this.betweenEnd) {
343
+ if (this.debuglog) {
344
+ console.log(this.audio.currentTime);
345
+ }
346
+ if (this.audio.currentTime >= this.betweenEnd) {
347
+ this.pause();
348
+ }
349
+ }
350
+ }
335
351
  }
336
352
  },
337
353
  betweenPlay() {
@@ -522,7 +538,7 @@ var _sfc_render = function render() {
522
538
  "timeupdate": _vm.updateTime,
523
539
  "ended": _vm.handleAudioEnded
524
540
  }
525
- }), typeof _vm.jumpTime === "undefined" ? _vm._t("jump", function() {
541
+ }), _vm.showJumpTime ? _vm._t("jump", function() {
526
542
  return [_c("div", {
527
543
  staticClass: "nf-audio-fast"
528
544
  }, [_c("i", {
@@ -58,6 +58,10 @@ const _sfc_main = {
58
58
  type: Number,
59
59
  default: 0
60
60
  },
61
+ showJumpTime: {
62
+ type: Boolean,
63
+ default: true
64
+ },
61
65
  // 快退秒数
62
66
  backSecond: {
63
67
  type: Number,
@@ -269,32 +273,34 @@ const _sfc_main = {
269
273
  }
270
274
  },
271
275
  async startAudioCtx() {
272
- if (!this.audioCtx) {
273
- this.audioCtx = new (window.AudioContext || window.webkitAudioContext)();
274
- this.audioSource = this.audioCtx.createMediaElementSource(this.audio);
275
- await this.audioCtx.audioWorklet.addModule("data:application/javascript," + encodeURIComponent(this.audioWorkletProcessor));
276
- this.processor = new AudioWorkletNode(this.audioCtx, "tick");
277
- this.audioSource.connect(this.processor).connect(this.audioCtx.destination);
278
- this.processor.port.onmessage = (event) => {
279
- if (event.data.command === "tick") {
280
- if (this.betweenPlaying) {
281
- if (this.betweenStart && this.betweenEnd) {
282
- if (this.debuglog) {
283
- console.log(this.audio.currentTime);
284
- }
285
- if (this.audio.currentTime >= this.betweenEnd) {
286
- this.pause();
276
+ if (window.location.protocol == "https:" || window.location.hostname === "localhost") {
277
+ if (!this.audioCtx) {
278
+ this.audioCtx = new (window.AudioContext || window.webkitAudioContext)();
279
+ this.audioSource = this.audioCtx.createMediaElementSource(this.audio);
280
+ await this.audioCtx.audioWorklet.addModule("data:application/javascript," + encodeURIComponent(this.audioWorkletProcessor));
281
+ this.processor = new AudioWorkletNode(this.audioCtx, "tick");
282
+ this.audioSource.connect(this.processor).connect(this.audioCtx.destination);
283
+ this.processor.port.onmessage = (event) => {
284
+ if (event.data.command === "tick") {
285
+ if (this.betweenPlaying) {
286
+ if (this.betweenEnd) {
287
+ if (this.debuglog) {
288
+ console.log(this.audio.currentTime);
289
+ }
290
+ if (this.audio.currentTime >= this.betweenEnd) {
291
+ this.pause();
292
+ }
287
293
  }
288
294
  }
289
295
  }
290
- }
291
- };
292
- } else {
293
- this.audioCtx.resume();
296
+ };
297
+ } else {
298
+ this.audioCtx.resume();
299
+ }
300
+ this.processor.port.postMessage({
301
+ command: "start"
302
+ });
294
303
  }
295
- this.processor.port.postMessage({
296
- command: "start"
297
- });
298
304
  },
299
305
  pause() {
300
306
  this.pauseAudio();
@@ -330,6 +336,16 @@ const _sfc_main = {
330
336
  this.$refs.progressCurrent.style.width = MoveX + "px";
331
337
  this.$refs.progressBar.style.left = MoveX - this.$refs.progressBar.clientWidth / 2 + "px";
332
338
  this.paused = false;
339
+ if (window.location.protocol == "http:" && window.location.hostname !== "localhost" && this.betweenPlaying) {
340
+ if (this.betweenEnd) {
341
+ if (this.debuglog) {
342
+ console.log(this.audio.currentTime);
343
+ }
344
+ if (this.audio.currentTime >= this.betweenEnd) {
345
+ this.pause();
346
+ }
347
+ }
348
+ }
333
349
  }
334
350
  },
335
351
  betweenPlay() {
@@ -520,7 +536,7 @@ var _sfc_render = function render() {
520
536
  "timeupdate": _vm.updateTime,
521
537
  "ended": _vm.handleAudioEnded
522
538
  }
523
- }), typeof _vm.jumpTime === "undefined" ? _vm._t("jump", function() {
539
+ }), _vm.showJumpTime ? _vm._t("jump", function() {
524
540
  return [_c("div", {
525
541
  staticClass: "nf-audio-fast"
526
542
  }, [_c("i", {
@@ -16,7 +16,7 @@
16
16
  />
17
17
 
18
18
  <!-- 跳帧 -->
19
- <slot name="jump" v-if="typeof jumpTime === 'undefined'">
19
+ <slot name="jump" v-if="showJumpTime">
20
20
  <div class="nf-audio-fast">
21
21
  <i class="iconfont icon-zanting1 nf-audio-fast-icon"
22
22
  @click="locationToTime(jumpTime)"
@@ -216,6 +216,10 @@ export default {
216
216
  type: Number,
217
217
  default: 0
218
218
  },
219
+ showJumpTime: {
220
+ type: Boolean,
221
+ default: true
222
+ },
219
223
  // 快退秒数
220
224
  backSecond: {
221
225
  type: Number,
@@ -434,30 +438,32 @@ export default {
434
438
  }
435
439
  },
436
440
  async startAudioCtx() {
437
- if (!this.audioCtx) {
438
- this.audioCtx = new (window.AudioContext || window.webkitAudioContext)();
439
- this.audioSource = this.audioCtx.createMediaElementSource(this.audio);
440
- await this.audioCtx.audioWorklet.addModule('data:application/javascript,' + encodeURIComponent(this.audioWorkletProcessor));
441
- this.processor = new AudioWorkletNode(this.audioCtx, 'tick');
442
- this.audioSource.connect(this.processor).connect(this.audioCtx.destination);
443
- this.processor.port.onmessage = (event) => {
444
- if (event.data.command === 'tick') {
445
- if (this.betweenPlaying) {
446
- if (this.betweenStart && this.betweenEnd) {
447
- if (this.debuglog) {
448
- console.log(this.audio.currentTime)
449
- }
450
- if (this.audio.currentTime >= this.betweenEnd) {
451
- this.pause()
441
+ if (window.location.protocol == 'https:' || window.location.hostname === 'localhost') {
442
+ if (!this.audioCtx) {
443
+ this.audioCtx = new (window.AudioContext || window.webkitAudioContext)();
444
+ this.audioSource = this.audioCtx.createMediaElementSource(this.audio);
445
+ await this.audioCtx.audioWorklet.addModule('data:application/javascript,' + encodeURIComponent(this.audioWorkletProcessor));
446
+ this.processor = new AudioWorkletNode(this.audioCtx, 'tick');
447
+ this.audioSource.connect(this.processor).connect(this.audioCtx.destination);
448
+ this.processor.port.onmessage = (event) => {
449
+ if (event.data.command === 'tick') {
450
+ if (this.betweenPlaying) {
451
+ if (this.betweenEnd) {
452
+ if (this.debuglog) {
453
+ console.log(this.audio.currentTime)
454
+ }
455
+ if (this.audio.currentTime >= this.betweenEnd) {
456
+ this.pause()
457
+ }
452
458
  }
453
459
  }
454
460
  }
455
- }
456
- };
457
- } else {
458
- this.audioCtx.resume()
461
+ };
462
+ } else {
463
+ this.audioCtx.resume()
464
+ }
465
+ this.processor.port.postMessage({ command: 'start' });
459
466
  }
460
- this.processor.port.postMessage({ command: 'start' });
461
467
  },
462
468
  pause() {
463
469
  this.pauseAudio()
@@ -495,6 +501,16 @@ export default {
495
501
  this.$refs.progressCurrent.style.width = MoveX + 'px'
496
502
  this.$refs.progressBar.style.left = MoveX - (this.$refs.progressBar.clientWidth / 2) + 'px'
497
503
  this.paused = false
504
+ if ((window.location.protocol == 'http:' && window.location.hostname !== 'localhost') && this.betweenPlaying) {
505
+ if (this.betweenEnd) {
506
+ if (this.debuglog) {
507
+ console.log(this.audio.currentTime)
508
+ }
509
+ if (this.audio.currentTime >= this.betweenEnd) {
510
+ this.pause()
511
+ }
512
+ }
513
+ }
498
514
  }
499
515
  },
500
516
  betweenPlay() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@94ai/nf-audio",
3
- "version": "3.3.61",
3
+ "version": "3.3.63",
4
4
  "description": "> TODO: description",
5
5
  "keywords": [],
6
6
  "author": "liuxiangxiang <liuxiangxiang@94ai.com>",
@@ -14,7 +14,7 @@
14
14
  "url": "http://94ai.gitlab.com/zoujiahe/common-ui.git"
15
15
  },
16
16
  "dependencies": {
17
- "@94ai/nf-theme-chalk": "^3.3.61",
17
+ "@94ai/nf-theme-chalk": "^3.3.63",
18
18
  "vue-demi": "^0.14.5"
19
19
  },
20
20
  "peerDependenciesMeta": {
@@ -30,5 +30,5 @@
30
30
  "types": "lib/index.d.ts",
31
31
  "main": "lib/nf-audio.cjs.js",
32
32
  "module": "lib/nf-audio.esm-bundler.js",
33
- "gitHead": "068f8237a674ca19312826eeadeb8cb36be24ebf"
33
+ "gitHead": "0d3ffe687f3d24f59ce6c26e377f92df03bf82a9"
34
34
  }