@94ai/nf-audio 3.3.73 → 3.3.75

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.
@@ -43,7 +43,7 @@ const _sfc_main = {
43
43
  },
44
44
  crossTimeTip: {
45
45
  type: String,
46
- default: "开始时间不能大于总时长"
46
+ default: "定位播放时间点不能大于音频总时长"
47
47
  },
48
48
  unloadTip: {
49
49
  type: String,
@@ -95,11 +95,11 @@ const _sfc_main = {
95
95
  },
96
96
  // 默认速度
97
97
  initSpeedValue: {
98
- type: Number,
98
+ type: Number | String,
99
99
  default: 1
100
100
  },
101
101
  initVolumnValue: {
102
- type: Number,
102
+ type: Number | String,
103
103
  default: 0.8
104
104
  },
105
105
  betweenStart: {
@@ -182,9 +182,9 @@ const _sfc_main = {
182
182
  }
183
183
  },
184
184
  mounted() {
185
- this.volume = this.initVolumnValue;
186
- this.volumeValue = this.initVolumnValue * 100;
187
- this.syncSpeed();
185
+ this.volume = Number(this.initVolumnValue);
186
+ this.volumeValue = this.volume * 100;
187
+ this.speed = Number(this.initSpeedValue);
188
188
  },
189
189
  beforeDestroy() {
190
190
  var _a, _b, _c, _d;
@@ -213,11 +213,6 @@ const _sfc_main = {
213
213
  this.betweenPlaying = false;
214
214
  this.jumpToTime(time);
215
215
  },
216
- syncSpeed() {
217
- if (this.speed != this.initSpeedValue) {
218
- this.speed = this.initSpeedValue;
219
- }
220
- },
221
216
  docClick(e) {
222
217
  if (this.$refs.popperRef.contains(e.target) || this.$refs.reference.contains(e.target)) {
223
218
  return;
@@ -478,10 +473,13 @@ const _sfc_main = {
478
473
  changeSpeed(speed) {
479
474
  if (!this.disabled) {
480
475
  if (this.audio) {
481
- this.audio.playbackRate = speed;
476
+ const preSpeed = this.speed;
477
+ this.speed = Number(speed);
478
+ if (this.speed !== preSpeed) {
479
+ this.audio.playbackRate = this.speed;
480
+ this.$emit("speedChange", this.speed);
481
+ }
482
482
  }
483
- this.speed = speed;
484
- this.$emit("speedChange", speed);
485
483
  }
486
484
  },
487
485
  downRecord(e) {
@@ -530,12 +528,15 @@ const _sfc_main = {
530
528
  return false;
531
529
  }
532
530
  if (time >= this.audio.duration) {
533
- this.audio.currentTime = this.audio.duration;
534
- this.currentTime = timeFormat(this.audio.currentTime);
535
- this.calcMoveX();
536
- this.playAudio();
537
531
  if (time > this.audio.duration) {
538
- console.error(this.crossTimeTip);
532
+ NfMessage.Message.warning(this.crossTimeTip);
533
+ this.paused = true;
534
+ this.betweenPlaying = false;
535
+ } else {
536
+ this.audio.currentTime = this.audio.duration;
537
+ this.currentTime = timeFormat(this.audio.currentTime);
538
+ this.calcMoveX();
539
+ this.playAudio();
539
540
  }
540
541
  return false;
541
542
  } else if (time >= 0 && time < this.audio.duration) {
@@ -555,16 +556,14 @@ const _sfc_main = {
555
556
  },
556
557
  watch: {
557
558
  initSpeedValue: {
558
- handle() {
559
- if (this.speed != this.initSpeedValue) {
560
- this.speed = this.initSpeedValue;
561
- }
559
+ handler() {
560
+ this.speed = Number(this.initSpeedValue);
562
561
  }
563
562
  },
564
563
  initVolumnValue: {
565
- handle() {
566
- this.volume = this.initVolumnValue;
567
- this.volumeValue = this.initVolumnValue * 100;
564
+ handler() {
565
+ this.volume = Number(this.initVolumnValue);
566
+ this.volumeValue = this.volume * 100;
568
567
  }
569
568
  },
570
569
  volumeVisible(val) {
@@ -818,7 +817,7 @@ var _sfc_render = function render() {
818
817
  return _c("div", {
819
818
  key: index,
820
819
  staticClass: "nf-audio-btn-item",
821
- class: _vm.speed == item ? "active" : "",
820
+ class: _vm.speed == Number(item) ? "active" : "",
822
821
  on: {
823
822
  "click": function($event) {
824
823
  return _vm.changeSpeed(item);
@@ -41,7 +41,7 @@ const _sfc_main = {
41
41
  },
42
42
  crossTimeTip: {
43
43
  type: String,
44
- default: "开始时间不能大于总时长"
44
+ default: "定位播放时间点不能大于音频总时长"
45
45
  },
46
46
  unloadTip: {
47
47
  type: String,
@@ -93,11 +93,11 @@ const _sfc_main = {
93
93
  },
94
94
  // 默认速度
95
95
  initSpeedValue: {
96
- type: Number,
96
+ type: Number | String,
97
97
  default: 1
98
98
  },
99
99
  initVolumnValue: {
100
- type: Number,
100
+ type: Number | String,
101
101
  default: 0.8
102
102
  },
103
103
  betweenStart: {
@@ -180,9 +180,9 @@ const _sfc_main = {
180
180
  }
181
181
  },
182
182
  mounted() {
183
- this.volume = this.initVolumnValue;
184
- this.volumeValue = this.initVolumnValue * 100;
185
- this.syncSpeed();
183
+ this.volume = Number(this.initVolumnValue);
184
+ this.volumeValue = this.volume * 100;
185
+ this.speed = Number(this.initSpeedValue);
186
186
  },
187
187
  beforeDestroy() {
188
188
  var _a, _b, _c, _d;
@@ -211,11 +211,6 @@ const _sfc_main = {
211
211
  this.betweenPlaying = false;
212
212
  this.jumpToTime(time);
213
213
  },
214
- syncSpeed() {
215
- if (this.speed != this.initSpeedValue) {
216
- this.speed = this.initSpeedValue;
217
- }
218
- },
219
214
  docClick(e) {
220
215
  if (this.$refs.popperRef.contains(e.target) || this.$refs.reference.contains(e.target)) {
221
216
  return;
@@ -476,10 +471,13 @@ const _sfc_main = {
476
471
  changeSpeed(speed) {
477
472
  if (!this.disabled) {
478
473
  if (this.audio) {
479
- this.audio.playbackRate = speed;
474
+ const preSpeed = this.speed;
475
+ this.speed = Number(speed);
476
+ if (this.speed !== preSpeed) {
477
+ this.audio.playbackRate = this.speed;
478
+ this.$emit("speedChange", this.speed);
479
+ }
480
480
  }
481
- this.speed = speed;
482
- this.$emit("speedChange", speed);
483
481
  }
484
482
  },
485
483
  downRecord(e) {
@@ -528,12 +526,15 @@ const _sfc_main = {
528
526
  return false;
529
527
  }
530
528
  if (time >= this.audio.duration) {
531
- this.audio.currentTime = this.audio.duration;
532
- this.currentTime = timeFormat(this.audio.currentTime);
533
- this.calcMoveX();
534
- this.playAudio();
535
529
  if (time > this.audio.duration) {
536
- console.error(this.crossTimeTip);
530
+ Message.warning(this.crossTimeTip);
531
+ this.paused = true;
532
+ this.betweenPlaying = false;
533
+ } else {
534
+ this.audio.currentTime = this.audio.duration;
535
+ this.currentTime = timeFormat(this.audio.currentTime);
536
+ this.calcMoveX();
537
+ this.playAudio();
537
538
  }
538
539
  return false;
539
540
  } else if (time >= 0 && time < this.audio.duration) {
@@ -553,16 +554,14 @@ const _sfc_main = {
553
554
  },
554
555
  watch: {
555
556
  initSpeedValue: {
556
- handle() {
557
- if (this.speed != this.initSpeedValue) {
558
- this.speed = this.initSpeedValue;
559
- }
557
+ handler() {
558
+ this.speed = Number(this.initSpeedValue);
560
559
  }
561
560
  },
562
561
  initVolumnValue: {
563
- handle() {
564
- this.volume = this.initVolumnValue;
565
- this.volumeValue = this.initVolumnValue * 100;
562
+ handler() {
563
+ this.volume = Number(this.initVolumnValue);
564
+ this.volumeValue = this.volume * 100;
566
565
  }
567
566
  },
568
567
  volumeVisible(val) {
@@ -816,7 +815,7 @@ var _sfc_render = function render() {
816
815
  return _c("div", {
817
816
  key: index,
818
817
  staticClass: "nf-audio-btn-item",
819
- class: _vm.speed == item ? "active" : "",
818
+ class: _vm.speed == Number(item) ? "active" : "",
820
819
  on: {
821
820
  "click": function($event) {
822
821
  return _vm.changeSpeed(item);
@@ -138,7 +138,7 @@
138
138
  <div v-for="(item,index) in multipleArray"
139
139
  :key="index"
140
140
  class="nf-audio-btn-item"
141
- :class="speed==item?'active':''"
141
+ :class="speed==Number(item)?'active':''"
142
142
  @click="changeSpeed(item)"
143
143
  >
144
144
  {{ speedPreDesc }}{{ item }}
@@ -203,7 +203,7 @@ export default {
203
203
  },
204
204
  crossTimeTip: {
205
205
  type: String,
206
- default: '开始时间不能大于总时长'
206
+ default: '定位播放时间点不能大于音频总时长'
207
207
  },
208
208
  unloadTip: {
209
209
  type: String,
@@ -255,11 +255,11 @@ export default {
255
255
  },
256
256
  // 默认速度
257
257
  initSpeedValue: {
258
- type: Number,
258
+ type: Number | String,
259
259
  default: 1.0
260
260
  },
261
261
  initVolumnValue: {
262
- type: Number,
262
+ type: Number | String,
263
263
  default: 0.8
264
264
  },
265
265
  betweenStart: {
@@ -346,9 +346,9 @@ export default {
346
346
  }
347
347
  },
348
348
  mounted() {
349
- this.volume = this.initVolumnValue
350
- this.volumeValue = this.initVolumnValue * 100
351
- this.syncSpeed()
349
+ this.volume = Number(this.initVolumnValue)
350
+ this.volumeValue = this.volume * 100
351
+ this.speed = Number(this.initSpeedValue)
352
352
  },
353
353
  beforeDestroy() {
354
354
  this.betweenPlaying = false
@@ -379,11 +379,6 @@ export default {
379
379
  this.betweenPlaying = false
380
380
  this.jumpToTime(time)
381
381
  },
382
- syncSpeed() {
383
- if (this.speed != this.initSpeedValue) {
384
- this.speed = this.initSpeedValue
385
- }
386
- },
387
382
  docClick(e) {
388
383
  //如果点击的是音量 或者 是音量面板 则 不隐藏音量面板
389
384
  if (this.$refs.popperRef.contains(e.target) || this.$refs.reference.contains(e.target)) {
@@ -652,10 +647,13 @@ export default {
652
647
  changeSpeed(speed) {
653
648
  if (!this.disabled) {
654
649
  if (this.audio) {
655
- this.audio.playbackRate = speed
650
+ const preSpeed = this.speed
651
+ this.speed = Number(speed)
652
+ if (this.speed !== preSpeed) {
653
+ this.audio.playbackRate = this.speed
654
+ this.$emit('speedChange', this.speed)
655
+ }
656
656
  }
657
- this.speed = speed
658
- this.$emit('speedChange', speed)
659
657
  }
660
658
  },
661
659
  downRecord(e) {
@@ -706,12 +704,15 @@ export default {
706
704
  return false
707
705
  }
708
706
  if (time >= this.audio.duration) {
709
- this.audio.currentTime = this.audio.duration
710
- this.currentTime = timeFormat(this.audio.currentTime)
711
- this.calcMoveX()
712
- this.playAudio()
713
707
  if (time > this.audio.duration) {
714
- console.error(this.crossTimeTip)
708
+ Message.warning(this.crossTimeTip)
709
+ this.paused = true
710
+ this.betweenPlaying = false
711
+ } else {
712
+ this.audio.currentTime = this.audio.duration
713
+ this.currentTime = timeFormat(this.audio.currentTime)
714
+ this.calcMoveX()
715
+ this.playAudio()
715
716
  }
716
717
  return false
717
718
  } else if (time >= 0 && time < this.audio.duration) {
@@ -731,16 +732,14 @@ export default {
731
732
  },
732
733
  watch: {
733
734
  initSpeedValue: {
734
- handle() {
735
- if (this.speed != this.initSpeedValue) {
736
- this.speed = this.initSpeedValue
737
- }
735
+ handler() {
736
+ this.speed = Number(this.initSpeedValue)
738
737
  }
739
738
  },
740
739
  initVolumnValue: {
741
- handle() {
742
- this.volume = this.initVolumnValue
743
- this.volumeValue = this.initVolumnValue * 100
740
+ handler() {
741
+ this.volume = Number(this.initVolumnValue)
742
+ this.volumeValue = this.volume * 100
744
743
  }
745
744
  },
746
745
  volumeVisible(val) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@94ai/nf-audio",
3
- "version": "3.3.73",
3
+ "version": "3.3.75",
4
4
  "description": "> TODO: description",
5
5
  "keywords": [],
6
6
  "author": "liuxiangxiang <liuxiangxiang@94ai.com>",
@@ -14,8 +14,8 @@
14
14
  "url": "http://94ai.gitlab.com/zoujiahe/common-ui.git"
15
15
  },
16
16
  "dependencies": {
17
- "@94ai/nf-message": "^3.3.73",
18
- "@94ai/nf-theme-chalk": "^3.3.73",
17
+ "@94ai/nf-message": "^3.3.75",
18
+ "@94ai/nf-theme-chalk": "^3.3.75",
19
19
  "vue-demi": "^0.14.5"
20
20
  },
21
21
  "peerDependenciesMeta": {
@@ -31,5 +31,5 @@
31
31
  "types": "lib/index.d.ts",
32
32
  "main": "lib/nf-audio.cjs.js",
33
33
  "module": "lib/nf-audio.esm-bundler.js",
34
- "gitHead": "7e95b41555babc235857fa1e7a5fa6c64da80bbd"
34
+ "gitHead": "3605bf1ea3b1c111a72d475fcf011bdf609c6f27"
35
35
  }