@94ai/nf-audio 3.3.62 → 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.
@@ -275,32 +275,34 @@ const _sfc_main = {
275
275
  }
276
276
  },
277
277
  async startAudioCtx() {
278
- if (!this.audioCtx) {
279
- this.audioCtx = new (window.AudioContext || window.webkitAudioContext)();
280
- this.audioSource = this.audioCtx.createMediaElementSource(this.audio);
281
- await this.audioCtx.audioWorklet.addModule("data:application/javascript," + encodeURIComponent(this.audioWorkletProcessor));
282
- this.processor = new AudioWorkletNode(this.audioCtx, "tick");
283
- this.audioSource.connect(this.processor).connect(this.audioCtx.destination);
284
- this.processor.port.onmessage = (event) => {
285
- if (event.data.command === "tick") {
286
- if (this.betweenPlaying) {
287
- if (this.betweenStart && this.betweenEnd) {
288
- if (this.debuglog) {
289
- console.log(this.audio.currentTime);
290
- }
291
- if (this.audio.currentTime >= this.betweenEnd) {
292
- 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
+ }
293
295
  }
294
296
  }
295
297
  }
296
- }
297
- };
298
- } else {
299
- this.audioCtx.resume();
298
+ };
299
+ } else {
300
+ this.audioCtx.resume();
301
+ }
302
+ this.processor.port.postMessage({
303
+ command: "start"
304
+ });
300
305
  }
301
- this.processor.port.postMessage({
302
- command: "start"
303
- });
304
306
  },
305
307
  pause() {
306
308
  this.pauseAudio();
@@ -336,6 +338,16 @@ const _sfc_main = {
336
338
  this.$refs.progressCurrent.style.width = MoveX + "px";
337
339
  this.$refs.progressBar.style.left = MoveX - this.$refs.progressBar.clientWidth / 2 + "px";
338
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
+ }
339
351
  }
340
352
  },
341
353
  betweenPlay() {
@@ -273,32 +273,34 @@ const _sfc_main = {
273
273
  }
274
274
  },
275
275
  async startAudioCtx() {
276
- if (!this.audioCtx) {
277
- this.audioCtx = new (window.AudioContext || window.webkitAudioContext)();
278
- this.audioSource = this.audioCtx.createMediaElementSource(this.audio);
279
- await this.audioCtx.audioWorklet.addModule("data:application/javascript," + encodeURIComponent(this.audioWorkletProcessor));
280
- this.processor = new AudioWorkletNode(this.audioCtx, "tick");
281
- this.audioSource.connect(this.processor).connect(this.audioCtx.destination);
282
- this.processor.port.onmessage = (event) => {
283
- if (event.data.command === "tick") {
284
- if (this.betweenPlaying) {
285
- if (this.betweenStart && this.betweenEnd) {
286
- if (this.debuglog) {
287
- console.log(this.audio.currentTime);
288
- }
289
- if (this.audio.currentTime >= this.betweenEnd) {
290
- 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
+ }
291
293
  }
292
294
  }
293
295
  }
294
- }
295
- };
296
- } else {
297
- this.audioCtx.resume();
296
+ };
297
+ } else {
298
+ this.audioCtx.resume();
299
+ }
300
+ this.processor.port.postMessage({
301
+ command: "start"
302
+ });
298
303
  }
299
- this.processor.port.postMessage({
300
- command: "start"
301
- });
302
304
  },
303
305
  pause() {
304
306
  this.pauseAudio();
@@ -334,6 +336,16 @@ const _sfc_main = {
334
336
  this.$refs.progressCurrent.style.width = MoveX + "px";
335
337
  this.$refs.progressBar.style.left = MoveX - this.$refs.progressBar.clientWidth / 2 + "px";
336
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
+ }
337
349
  }
338
350
  },
339
351
  betweenPlay() {
@@ -438,30 +438,32 @@ export default {
438
438
  }
439
439
  },
440
440
  async startAudioCtx() {
441
- if (!this.audioCtx) {
442
- this.audioCtx = new (window.AudioContext || window.webkitAudioContext)();
443
- this.audioSource = this.audioCtx.createMediaElementSource(this.audio);
444
- await this.audioCtx.audioWorklet.addModule('data:application/javascript,' + encodeURIComponent(this.audioWorkletProcessor));
445
- this.processor = new AudioWorkletNode(this.audioCtx, 'tick');
446
- this.audioSource.connect(this.processor).connect(this.audioCtx.destination);
447
- this.processor.port.onmessage = (event) => {
448
- if (event.data.command === 'tick') {
449
- if (this.betweenPlaying) {
450
- if (this.betweenStart && this.betweenEnd) {
451
- if (this.debuglog) {
452
- console.log(this.audio.currentTime)
453
- }
454
- if (this.audio.currentTime >= this.betweenEnd) {
455
- 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
+ }
456
458
  }
457
459
  }
458
460
  }
459
- }
460
- };
461
- } else {
462
- this.audioCtx.resume()
461
+ };
462
+ } else {
463
+ this.audioCtx.resume()
464
+ }
465
+ this.processor.port.postMessage({ command: 'start' });
463
466
  }
464
- this.processor.port.postMessage({ command: 'start' });
465
467
  },
466
468
  pause() {
467
469
  this.pauseAudio()
@@ -499,6 +501,16 @@ export default {
499
501
  this.$refs.progressCurrent.style.width = MoveX + 'px'
500
502
  this.$refs.progressBar.style.left = MoveX - (this.$refs.progressBar.clientWidth / 2) + 'px'
501
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
+ }
502
514
  }
503
515
  },
504
516
  betweenPlay() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@94ai/nf-audio",
3
- "version": "3.3.62",
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.62",
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": "eb66eba98360c212306e6c23a786e75bce214924"
33
+ "gitHead": "0d3ffe687f3d24f59ce6c26e377f92df03bf82a9"
34
34
  }