@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.
- package/lib/nf-audio.cjs.js +34 -22
- package/lib/nf-audio.esm-bundler.js +34 -22
- package/package/nf-audio.vue +32 -20
- package/package.json +3 -3
package/lib/nf-audio.cjs.js
CHANGED
|
@@ -275,32 +275,34 @@ const _sfc_main = {
|
|
|
275
275
|
}
|
|
276
276
|
},
|
|
277
277
|
async startAudioCtx() {
|
|
278
|
-
if (
|
|
279
|
-
this.audioCtx
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
if (
|
|
287
|
-
if (this.
|
|
288
|
-
if (this.
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
this.
|
|
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
|
-
|
|
299
|
-
|
|
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 (
|
|
277
|
-
this.audioCtx
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
if (
|
|
285
|
-
if (this.
|
|
286
|
-
if (this.
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
this.
|
|
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
|
-
|
|
297
|
-
|
|
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() {
|
package/package/nf-audio.vue
CHANGED
|
@@ -438,30 +438,32 @@ export default {
|
|
|
438
438
|
}
|
|
439
439
|
},
|
|
440
440
|
async startAudioCtx() {
|
|
441
|
-
if (
|
|
442
|
-
this.audioCtx
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
if (
|
|
450
|
-
if (this.
|
|
451
|
-
if (this.
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
this.
|
|
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
|
-
|
|
462
|
-
|
|
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.
|
|
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.
|
|
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": "
|
|
33
|
+
"gitHead": "0d3ffe687f3d24f59ce6c26e377f92df03bf82a9"
|
|
34
34
|
}
|