@94ai/nf-audio 3.3.63 → 3.3.65
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 +18 -7
- package/lib/nf-audio.esm-bundler.js +18 -7
- package/package/nf-audio.vue +15 -7
- package/package.json +3 -3
package/lib/nf-audio.cjs.js
CHANGED
|
@@ -97,6 +97,10 @@ const _sfc_main = {
|
|
|
97
97
|
betweenEnd: {
|
|
98
98
|
type: Number,
|
|
99
99
|
default: 0
|
|
100
|
+
},
|
|
101
|
+
highPrecision: {
|
|
102
|
+
type: Boolean,
|
|
103
|
+
default: false
|
|
100
104
|
}
|
|
101
105
|
},
|
|
102
106
|
data() {
|
|
@@ -274,8 +278,14 @@ const _sfc_main = {
|
|
|
274
278
|
} catch (e) {
|
|
275
279
|
}
|
|
276
280
|
},
|
|
281
|
+
isHighPrecision() {
|
|
282
|
+
if (this.highPrecision) {
|
|
283
|
+
return true;
|
|
284
|
+
}
|
|
285
|
+
return window.location.protocol === "https:" || window.location.hostname === "localhost";
|
|
286
|
+
},
|
|
277
287
|
async startAudioCtx() {
|
|
278
|
-
if (
|
|
288
|
+
if (this.isHighPrecision()) {
|
|
279
289
|
if (!this.audioCtx) {
|
|
280
290
|
this.audioCtx = new (window.AudioContext || window.webkitAudioContext)();
|
|
281
291
|
this.audioSource = this.audioCtx.createMediaElementSource(this.audio);
|
|
@@ -338,7 +348,7 @@ const _sfc_main = {
|
|
|
338
348
|
this.$refs.progressCurrent.style.width = MoveX + "px";
|
|
339
349
|
this.$refs.progressBar.style.left = MoveX - this.$refs.progressBar.clientWidth / 2 + "px";
|
|
340
350
|
this.paused = false;
|
|
341
|
-
if (
|
|
351
|
+
if (!this.isHighPrecision() && this.betweenPlaying) {
|
|
342
352
|
if (this.betweenEnd) {
|
|
343
353
|
if (this.debuglog) {
|
|
344
354
|
console.log(this.audio.currentTime);
|
|
@@ -376,10 +386,8 @@ const _sfc_main = {
|
|
|
376
386
|
this.betweenPlaying = false;
|
|
377
387
|
return false;
|
|
378
388
|
}
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
this.$emit("updateProgress", e.offsetX);
|
|
382
|
-
}
|
|
389
|
+
this.updateProgress(e.offsetX);
|
|
390
|
+
this.$emit("updateProgress", e.offsetX);
|
|
383
391
|
}
|
|
384
392
|
},
|
|
385
393
|
//更新进度
|
|
@@ -633,7 +641,10 @@ var _sfc_render = function render() {
|
|
|
633
641
|
ref: "progressBar",
|
|
634
642
|
staticClass: "nf-audio-progress-bar",
|
|
635
643
|
on: {
|
|
636
|
-
"mousedown": _vm.handleMousedown
|
|
644
|
+
"mousedown": _vm.handleMousedown,
|
|
645
|
+
"click": function($event) {
|
|
646
|
+
$event.stopPropagation();
|
|
647
|
+
}
|
|
637
648
|
}
|
|
638
649
|
})])])];
|
|
639
650
|
}), _vm.forwardSecond ? _vm._t("fastForward", function() {
|
|
@@ -95,6 +95,10 @@ const _sfc_main = {
|
|
|
95
95
|
betweenEnd: {
|
|
96
96
|
type: Number,
|
|
97
97
|
default: 0
|
|
98
|
+
},
|
|
99
|
+
highPrecision: {
|
|
100
|
+
type: Boolean,
|
|
101
|
+
default: false
|
|
98
102
|
}
|
|
99
103
|
},
|
|
100
104
|
data() {
|
|
@@ -272,8 +276,14 @@ const _sfc_main = {
|
|
|
272
276
|
} catch (e) {
|
|
273
277
|
}
|
|
274
278
|
},
|
|
279
|
+
isHighPrecision() {
|
|
280
|
+
if (this.highPrecision) {
|
|
281
|
+
return true;
|
|
282
|
+
}
|
|
283
|
+
return window.location.protocol === "https:" || window.location.hostname === "localhost";
|
|
284
|
+
},
|
|
275
285
|
async startAudioCtx() {
|
|
276
|
-
if (
|
|
286
|
+
if (this.isHighPrecision()) {
|
|
277
287
|
if (!this.audioCtx) {
|
|
278
288
|
this.audioCtx = new (window.AudioContext || window.webkitAudioContext)();
|
|
279
289
|
this.audioSource = this.audioCtx.createMediaElementSource(this.audio);
|
|
@@ -336,7 +346,7 @@ const _sfc_main = {
|
|
|
336
346
|
this.$refs.progressCurrent.style.width = MoveX + "px";
|
|
337
347
|
this.$refs.progressBar.style.left = MoveX - this.$refs.progressBar.clientWidth / 2 + "px";
|
|
338
348
|
this.paused = false;
|
|
339
|
-
if (
|
|
349
|
+
if (!this.isHighPrecision() && this.betweenPlaying) {
|
|
340
350
|
if (this.betweenEnd) {
|
|
341
351
|
if (this.debuglog) {
|
|
342
352
|
console.log(this.audio.currentTime);
|
|
@@ -374,10 +384,8 @@ const _sfc_main = {
|
|
|
374
384
|
this.betweenPlaying = false;
|
|
375
385
|
return false;
|
|
376
386
|
}
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
this.$emit("updateProgress", e.offsetX);
|
|
380
|
-
}
|
|
387
|
+
this.updateProgress(e.offsetX);
|
|
388
|
+
this.$emit("updateProgress", e.offsetX);
|
|
381
389
|
}
|
|
382
390
|
},
|
|
383
391
|
//更新进度
|
|
@@ -631,7 +639,10 @@ var _sfc_render = function render() {
|
|
|
631
639
|
ref: "progressBar",
|
|
632
640
|
staticClass: "nf-audio-progress-bar",
|
|
633
641
|
on: {
|
|
634
|
-
"mousedown": _vm.handleMousedown
|
|
642
|
+
"mousedown": _vm.handleMousedown,
|
|
643
|
+
"click": function($event) {
|
|
644
|
+
$event.stopPropagation();
|
|
645
|
+
}
|
|
635
646
|
}
|
|
636
647
|
})])])];
|
|
637
648
|
}), _vm.forwardSecond ? _vm._t("fastForward", function() {
|
package/package/nf-audio.vue
CHANGED
|
@@ -70,6 +70,7 @@
|
|
|
70
70
|
<span class="nf-audio-progress-bar"
|
|
71
71
|
ref="progressBar"
|
|
72
72
|
@mousedown="handleMousedown"
|
|
73
|
+
@click.stop
|
|
73
74
|
/>
|
|
74
75
|
</div>
|
|
75
76
|
</div>
|
|
@@ -253,6 +254,10 @@ export default {
|
|
|
253
254
|
betweenEnd: {
|
|
254
255
|
type: Number,
|
|
255
256
|
default: 0
|
|
257
|
+
},
|
|
258
|
+
highPrecision: {
|
|
259
|
+
type: Boolean,
|
|
260
|
+
default: false
|
|
256
261
|
}
|
|
257
262
|
},
|
|
258
263
|
data() {
|
|
@@ -437,8 +442,14 @@ export default {
|
|
|
437
442
|
//
|
|
438
443
|
}
|
|
439
444
|
},
|
|
445
|
+
isHighPrecision() {
|
|
446
|
+
if (this.highPrecision) {
|
|
447
|
+
return true
|
|
448
|
+
}
|
|
449
|
+
return window.location.protocol === 'https:' || window.location.hostname === 'localhost'
|
|
450
|
+
},
|
|
440
451
|
async startAudioCtx() {
|
|
441
|
-
if (
|
|
452
|
+
if (this.isHighPrecision()) {
|
|
442
453
|
if (!this.audioCtx) {
|
|
443
454
|
this.audioCtx = new (window.AudioContext || window.webkitAudioContext)();
|
|
444
455
|
this.audioSource = this.audioCtx.createMediaElementSource(this.audio);
|
|
@@ -501,7 +512,7 @@ export default {
|
|
|
501
512
|
this.$refs.progressCurrent.style.width = MoveX + 'px'
|
|
502
513
|
this.$refs.progressBar.style.left = MoveX - (this.$refs.progressBar.clientWidth / 2) + 'px'
|
|
503
514
|
this.paused = false
|
|
504
|
-
if ((
|
|
515
|
+
if (!this.isHighPrecision() && this.betweenPlaying) {
|
|
505
516
|
if (this.betweenEnd) {
|
|
506
517
|
if (this.debuglog) {
|
|
507
518
|
console.log(this.audio.currentTime)
|
|
@@ -539,11 +550,8 @@ export default {
|
|
|
539
550
|
this.betweenPlaying = false
|
|
540
551
|
return false
|
|
541
552
|
}
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
this.updateProgress(e.offsetX)
|
|
545
|
-
this.$emit('updateProgress', e.offsetX)
|
|
546
|
-
}
|
|
553
|
+
this.updateProgress(e.offsetX)
|
|
554
|
+
this.$emit('updateProgress', e.offsetX)
|
|
547
555
|
}
|
|
548
556
|
},
|
|
549
557
|
//更新进度
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@94ai/nf-audio",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.65",
|
|
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.65",
|
|
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": "925028777636d97723ff1e81517c48c1b6c00547"
|
|
34
34
|
}
|