@94ai/nf-audio 3.3.53 → 3.3.55
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/index.d.ts +2 -222
- package/lib/nf-audio.cjs.js +420 -352
- package/lib/nf-audio.esm-bundler.js +420 -352
- package/lib/nf-audio.vue.d.ts +1 -77
- package/lib/util.d.ts +1 -0
- package/package/nf-audio.vue +346 -164
- package/package/util.ts +6 -0
- package/package.json +3 -3
- package/lib/more-btn.vue.d.ts +0 -17
- package/lib/volume-tool.vue.d.ts +0 -17
- package/package/more-btn.vue +0 -49
- package/package/volume-tool.vue +0 -54
package/lib/nf-audio.cjs.js
CHANGED
|
@@ -1,221 +1,149 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const vueDemi = require("vue-demi");
|
|
4
|
-
const vue2RuntimeHelpers = require("@94ai/vue2-runtime-helpers");
|
|
5
3
|
const nfMessage = require("@94ai/nf-message");
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const reference = vueDemi.ref();
|
|
15
|
-
const popperRef = vueDemi.ref();
|
|
16
|
-
vueDemi.watch(() => props.visible, (newValue) => {
|
|
17
|
-
if (newValue) {
|
|
18
|
-
window.addEventListener("mousedown", docClick);
|
|
19
|
-
} else {
|
|
20
|
-
window.removeEventListener("mousedown", docClick);
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
function docClick(e) {
|
|
24
|
-
if (popperRef.value.contains(e.target) || reference.value.contains(e.target)) {
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
emits("update:visible", false);
|
|
28
|
-
}
|
|
29
|
-
function showPopper() {
|
|
30
|
-
if (!props.disabled) {
|
|
31
|
-
emits("update:visible", true);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
vueDemi.onUnmounted(() => {
|
|
35
|
-
emits("update:visible", false);
|
|
36
|
-
});
|
|
37
|
-
return Object.assign({
|
|
38
|
-
reference,
|
|
39
|
-
popperRef,
|
|
40
|
-
showPopper
|
|
41
|
-
}, {
|
|
42
|
-
showPopper
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
const _sfc_main$2 = __sfc_main;
|
|
46
|
-
var _sfc_render$2 = function render() {
|
|
47
|
-
var _vm = this, _c = _vm._self._c;
|
|
48
|
-
_vm._self._setupProxy;
|
|
49
|
-
return _c("div", {
|
|
50
|
-
staticClass: "nf-volume-tool",
|
|
51
|
-
class: _vm.visible ? "nf-tool-show" : "nf-tool-hide",
|
|
52
|
-
on: {
|
|
53
|
-
"click": _vm.showPopper
|
|
54
|
-
}
|
|
55
|
-
}, [_c("div", {
|
|
56
|
-
ref: "reference"
|
|
57
|
-
}, [_vm._t("reference")], 2), _c("transition", {
|
|
58
|
-
attrs: {
|
|
59
|
-
"name": "slide-fade"
|
|
60
|
-
}
|
|
61
|
-
}, [_c("div", {
|
|
62
|
-
directives: [{
|
|
63
|
-
name: "show",
|
|
64
|
-
rawName: "v-show",
|
|
65
|
-
value: _vm.visible,
|
|
66
|
-
expression: "visible"
|
|
67
|
-
}],
|
|
68
|
-
ref: "popperRef",
|
|
69
|
-
staticClass: "nf-popper"
|
|
70
|
-
}, [_vm._t("default")], 2)])], 1);
|
|
71
|
-
};
|
|
72
|
-
var _sfc_staticRenderFns$2 = [];
|
|
73
|
-
var __component__$2 = /* @__PURE__ */ vue2RuntimeHelpers.normalizeComponent(_sfc_main$2, _sfc_render$2, _sfc_staticRenderFns$2, false, null, null, null, null);
|
|
74
|
-
const volumeTool = __component__$2.exports;
|
|
75
|
-
const _sfc_main$1 = {
|
|
76
|
-
name: "more-btn",
|
|
77
|
-
components: {},
|
|
4
|
+
const vue2RuntimeHelpers = require("@94ai/vue2-runtime-helpers");
|
|
5
|
+
function timeFormat(value) {
|
|
6
|
+
const minute = parseInt(String(value / 60));
|
|
7
|
+
const second = parseInt(String(value % 60));
|
|
8
|
+
return (minute >= 10 ? minute : "0" + minute) + ":" + (second >= 10 ? second : "0" + second);
|
|
9
|
+
}
|
|
10
|
+
const _sfc_main = {
|
|
11
|
+
name: "nf-audio",
|
|
78
12
|
props: {
|
|
79
|
-
|
|
80
|
-
type:
|
|
81
|
-
default: false
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
data() {
|
|
85
|
-
return {
|
|
86
|
-
multipleArray: ["1.0", "1.25", "1.5", "1.75", "2.0"],
|
|
87
|
-
speed: ""
|
|
88
|
-
};
|
|
89
|
-
},
|
|
90
|
-
mounted() {
|
|
91
|
-
},
|
|
92
|
-
methods: {
|
|
93
|
-
handleDown() {
|
|
94
|
-
this.$emit("down");
|
|
13
|
+
size: {
|
|
14
|
+
type: String
|
|
95
15
|
},
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
var _sfc_render$1 = function render2() {
|
|
103
|
-
var _vm = this, _c = _vm._self._c;
|
|
104
|
-
return _c("div", {
|
|
105
|
-
staticClass: "more-btn-box"
|
|
106
|
-
}, [_c("el-popover", {
|
|
107
|
-
attrs: {
|
|
108
|
-
"placement": "right",
|
|
109
|
-
"popper-class": "audio-popover",
|
|
110
|
-
"disabled": _vm.disabled
|
|
111
|
-
}
|
|
112
|
-
}, [_c("div", {
|
|
113
|
-
staticClass: "audio-btn-list"
|
|
114
|
-
}, [_c("el-popover", {
|
|
115
|
-
attrs: {
|
|
116
|
-
"placement": "right",
|
|
117
|
-
"popper-class": "audio-popover"
|
|
118
|
-
}
|
|
119
|
-
}, [_c("div", {
|
|
120
|
-
staticClass: "audio-btn-list"
|
|
121
|
-
}, _vm._l(_vm.multipleArray, function(item, index) {
|
|
122
|
-
return _c("div", {
|
|
123
|
-
key: index,
|
|
124
|
-
staticClass: "btn-item",
|
|
125
|
-
class: _vm.speed === item ? "active" : "",
|
|
126
|
-
on: {
|
|
127
|
-
"click": function($event) {
|
|
128
|
-
return _vm.handleSpeed(item);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}, [_vm._v("x " + _vm._s(item))]);
|
|
132
|
-
}), 0), _c("div", {
|
|
133
|
-
staticClass: "btn-item",
|
|
134
|
-
attrs: {
|
|
135
|
-
"slot": "reference"
|
|
16
|
+
speedDesc: {
|
|
17
|
+
type: String,
|
|
18
|
+
default: "倍速"
|
|
136
19
|
},
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
20
|
+
downloadDesc: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: "下载"
|
|
23
|
+
},
|
|
24
|
+
speedPreDesc: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: "x "
|
|
27
|
+
},
|
|
28
|
+
crossTimeTip: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: "开始时间不能大于总时长"
|
|
31
|
+
},
|
|
32
|
+
unloadTip: {
|
|
33
|
+
type: String,
|
|
34
|
+
default: "音频还未加载完成"
|
|
147
35
|
},
|
|
148
|
-
slot: "reference"
|
|
149
|
-
}, [_c("i", {
|
|
150
|
-
staticClass: "iconfont icon-gengduo1 more-btn"
|
|
151
|
-
})])])], 1);
|
|
152
|
-
};
|
|
153
|
-
var _sfc_staticRenderFns$1 = [];
|
|
154
|
-
var __component__$1 = /* @__PURE__ */ vue2RuntimeHelpers.normalizeComponent(_sfc_main$1, _sfc_render$1, _sfc_staticRenderFns$1, false, null, null, null, null);
|
|
155
|
-
const moreBtn = __component__$1.exports;
|
|
156
|
-
const _sfc_main = {
|
|
157
|
-
name: "nf-audio",
|
|
158
|
-
components: {
|
|
159
|
-
volumeTool,
|
|
160
|
-
moreBtn
|
|
161
|
-
},
|
|
162
|
-
props: {
|
|
163
36
|
disabled: {
|
|
164
37
|
type: Boolean,
|
|
165
38
|
default: false
|
|
166
39
|
},
|
|
167
|
-
|
|
40
|
+
background: {
|
|
168
41
|
type: Boolean,
|
|
169
42
|
default: true
|
|
170
43
|
},
|
|
171
|
-
|
|
44
|
+
// 音频地址
|
|
45
|
+
src: {
|
|
46
|
+
type: String,
|
|
47
|
+
default: ""
|
|
48
|
+
},
|
|
49
|
+
// 更多功能
|
|
50
|
+
showMoreBtn: {
|
|
172
51
|
type: Boolean,
|
|
173
52
|
default: true
|
|
174
53
|
},
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
54
|
+
// 跳转时间
|
|
55
|
+
jumpTime: {
|
|
56
|
+
type: Number,
|
|
57
|
+
default: 0
|
|
178
58
|
},
|
|
59
|
+
// 快退秒数
|
|
179
60
|
backSecond: {
|
|
180
61
|
type: Number,
|
|
181
|
-
default:
|
|
62
|
+
default: 0
|
|
182
63
|
},
|
|
64
|
+
// 快进秒数
|
|
183
65
|
forwardSecond: {
|
|
184
66
|
type: Number,
|
|
185
|
-
default:
|
|
67
|
+
default: 0
|
|
68
|
+
},
|
|
69
|
+
// 速度调整
|
|
70
|
+
multipleArray: {
|
|
71
|
+
type: Array,
|
|
72
|
+
default() {
|
|
73
|
+
return ["1.0", "1.25", "1.5", "1.75", "2.0", "2.5", "3.0", "3.5", "4.0"];
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
// 默认速度
|
|
77
|
+
initSpeedValue: {
|
|
78
|
+
type: Number,
|
|
79
|
+
default: 1
|
|
186
80
|
},
|
|
187
|
-
|
|
81
|
+
initVolumnValue: {
|
|
188
82
|
type: Number,
|
|
189
|
-
default: 0
|
|
83
|
+
default: 0.8
|
|
190
84
|
}
|
|
191
85
|
},
|
|
192
86
|
data() {
|
|
193
87
|
return {
|
|
194
|
-
|
|
195
|
-
currentDuration: "00:00",
|
|
196
|
-
audio: "",
|
|
197
|
-
volume: 0.8,
|
|
88
|
+
// 播放还是暂停
|
|
198
89
|
paused: true,
|
|
199
|
-
|
|
200
|
-
|
|
90
|
+
moveMin: 0,
|
|
91
|
+
moveMax: 0,
|
|
92
|
+
progressBarWidth: 0,
|
|
93
|
+
// 总播放时间
|
|
94
|
+
totalTime: "00:00",
|
|
95
|
+
// 当前播放时间
|
|
96
|
+
currentTime: "00:00",
|
|
97
|
+
// 调整播放音量比例
|
|
201
98
|
volumeValue: 80,
|
|
99
|
+
// 音量
|
|
100
|
+
volume: 0.8,
|
|
101
|
+
// 音量调节面板
|
|
102
|
+
volumeVisible: false,
|
|
103
|
+
// 播放速度
|
|
202
104
|
speed: 1
|
|
203
105
|
};
|
|
204
106
|
},
|
|
107
|
+
computed: {
|
|
108
|
+
audio() {
|
|
109
|
+
return this.$refs.audio;
|
|
110
|
+
}
|
|
111
|
+
},
|
|
205
112
|
mounted() {
|
|
206
|
-
this.
|
|
113
|
+
this.speed = this.initSpeedValue;
|
|
114
|
+
this.volume = this.initVolumnValue;
|
|
115
|
+
this.volumeValue = this.initVolumnValue * 100;
|
|
207
116
|
},
|
|
208
117
|
methods: {
|
|
118
|
+
docClick(e) {
|
|
119
|
+
if (this.$refs.popperRef.contains(e.target) || this.$refs.reference.contains(e.target)) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
this.volumeVisible = false;
|
|
123
|
+
},
|
|
124
|
+
showPopper() {
|
|
125
|
+
if (!this.disabled) {
|
|
126
|
+
this.volumeVisible = !this.volumeVisible;
|
|
127
|
+
}
|
|
128
|
+
},
|
|
209
129
|
//后退
|
|
210
130
|
handleBack() {
|
|
211
|
-
if (this.audio.currentTime
|
|
212
|
-
this.
|
|
131
|
+
if (this.audio.currentTime - this.backSecond <= 0) {
|
|
132
|
+
this.jumpToTime(0);
|
|
133
|
+
} else {
|
|
134
|
+
if (this.audio.currentTime < this.audio.duration) {
|
|
135
|
+
this.jumpToTime(this.audio.currentTime - this.backSecond);
|
|
136
|
+
}
|
|
213
137
|
}
|
|
214
138
|
},
|
|
215
139
|
//前进
|
|
216
140
|
handleForward() {
|
|
217
|
-
if (this.audio.
|
|
218
|
-
this.
|
|
141
|
+
if (this.audio.currentTime + this.forwardSecond <= this.audio.duration) {
|
|
142
|
+
this.jumpToTime(this.audio.currentTime + this.forwardSecond);
|
|
143
|
+
} else {
|
|
144
|
+
if (this.audio.currentTime < this.audio.duration) {
|
|
145
|
+
this.jumpToTime(this.audio.duration);
|
|
146
|
+
}
|
|
219
147
|
}
|
|
220
148
|
},
|
|
221
149
|
//暂停或播放
|
|
@@ -227,44 +155,37 @@ const _sfc_main = {
|
|
|
227
155
|
this.paused = !this.paused;
|
|
228
156
|
} else {
|
|
229
157
|
console.log("Audio is not ready yet.");
|
|
230
|
-
nfMessage.Message.warning(
|
|
158
|
+
nfMessage.Message.warning(this.unloadTip);
|
|
231
159
|
}
|
|
232
160
|
}
|
|
233
161
|
},
|
|
234
162
|
//视频在可以播放时触发
|
|
235
163
|
getDuration() {
|
|
236
|
-
this.
|
|
164
|
+
this.totalTime = timeFormat(this.audio.duration);
|
|
237
165
|
this.audio.volume = this.volume;
|
|
238
166
|
},
|
|
239
|
-
//将单位为秒的的时间转换成mm:ss的形式
|
|
240
|
-
timeFormat(number) {
|
|
241
|
-
let minute = parseInt(number / 60);
|
|
242
|
-
let second = parseInt(number % 60);
|
|
243
|
-
minute = minute >= 10 ? minute : "0" + minute;
|
|
244
|
-
second = second >= 10 ? second : "0" + second;
|
|
245
|
-
return minute + ":" + second;
|
|
246
|
-
},
|
|
247
167
|
//进度条发生变化时触发
|
|
248
168
|
updateTime() {
|
|
249
|
-
if (!this.$refs.
|
|
169
|
+
if (!this.$refs.progressContainer)
|
|
250
170
|
return;
|
|
251
|
-
this.
|
|
171
|
+
this.currentTime = timeFormat(this.audio.currentTime);
|
|
252
172
|
if (!this.audio.paused) {
|
|
253
|
-
let MoveX = this.$refs.
|
|
254
|
-
this.$refs.
|
|
255
|
-
this.$refs.
|
|
173
|
+
let MoveX = this.$refs.progressContainer.clientWidth * (this.audio.currentTime / this.audio.duration);
|
|
174
|
+
this.$refs.progressCurrent.style.width = MoveX + "px";
|
|
175
|
+
this.$refs.progressBar.style.left = MoveX - this.$refs.progressBar.clientWidth / 2 + "px";
|
|
256
176
|
this.paused = false;
|
|
257
177
|
}
|
|
258
178
|
},
|
|
259
179
|
handleAudioEnded() {
|
|
260
|
-
|
|
180
|
+
this.$refs.progressCurrent.style.width = this.$refs.progressContainer.clientWidth + "px";
|
|
181
|
+
this.$refs.progressBar.style.left = this.$refs.progressContainer.clientWidth - this.$refs.progressBar.clientWidth / 2 + "px";
|
|
261
182
|
this.paused = true;
|
|
262
183
|
},
|
|
263
184
|
//点击进度条更新进度
|
|
264
185
|
clickProgress(e) {
|
|
265
186
|
if (!this.disabled) {
|
|
266
|
-
if (this.duration ===
|
|
267
|
-
nfMessage.Message.warning(
|
|
187
|
+
if (this.audio.duration === 0) {
|
|
188
|
+
nfMessage.Message.warning(this.unloadTip);
|
|
268
189
|
return false;
|
|
269
190
|
}
|
|
270
191
|
if (!this.audio.paused) {
|
|
@@ -274,100 +195,95 @@ const _sfc_main = {
|
|
|
274
195
|
},
|
|
275
196
|
//更新进度
|
|
276
197
|
updateProgress(MoveX) {
|
|
277
|
-
|
|
198
|
+
const clickProgress = MoveX / this.$refs.progressContainer.clientWidth;
|
|
278
199
|
this.audio.currentTime = this.audio.duration * clickProgress;
|
|
279
|
-
this.$refs.
|
|
280
|
-
this.$refs.
|
|
200
|
+
this.$refs.progressCurrent.style.width = MoveX + "px";
|
|
201
|
+
this.$refs.progressBar.style.left = MoveX - this.$refs.progressBar.clientWidth / 2 + "px";
|
|
281
202
|
},
|
|
282
203
|
//鼠标弹起
|
|
283
204
|
handleMouseup() {
|
|
284
205
|
if (!this.disabled) {
|
|
285
|
-
if (this.duration ===
|
|
286
|
-
nfMessage.Message.warning(
|
|
206
|
+
if (this.audio.duration === 0) {
|
|
207
|
+
nfMessage.Message.warning(this.unloadTip);
|
|
287
208
|
return false;
|
|
288
209
|
}
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
this.paused = false;
|
|
292
|
-
clearTimeout(timer);
|
|
293
|
-
}, 200);
|
|
294
|
-
this.$once("hook:beforeDestroy", () => {
|
|
295
|
-
clearTimeout(timer);
|
|
296
|
-
});
|
|
210
|
+
this.audio.play();
|
|
211
|
+
this.paused = false;
|
|
297
212
|
}
|
|
298
213
|
},
|
|
214
|
+
moveX(e) {
|
|
215
|
+
if (e.pageX >= this.moveMax) {
|
|
216
|
+
return;
|
|
217
|
+
} else if (e.pageX <= this.moveMin) {
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
this.$refs.progressBar.style.left = e.pageX - this.moveMin - this.progressBarWidth + "px";
|
|
221
|
+
this.updateProgress(e.pageX - this.moveMin);
|
|
222
|
+
},
|
|
299
223
|
//调整进度
|
|
300
224
|
handleMousedown() {
|
|
301
225
|
if (!this.disabled) {
|
|
302
226
|
this.audio.pause();
|
|
303
227
|
this.paused = true;
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
if (e.pageX >= moveMax) {
|
|
310
|
-
return;
|
|
311
|
-
} else if (e.pageX <= moveMin) {
|
|
312
|
-
return;
|
|
313
|
-
}
|
|
314
|
-
this.$refs.circle.style.left = e.pageX - moveMin - circleWidth + "px";
|
|
315
|
-
this.updateProgress(e.pageX - moveMin);
|
|
316
|
-
};
|
|
317
|
-
document.addEventListener("mousemove", moveX);
|
|
228
|
+
const progressContainer = this.$refs.progressContainer;
|
|
229
|
+
this.moveMin = progressContainer.offsetParent.offsetLeft + progressContainer.offsetLeft;
|
|
230
|
+
this.moveMax = progressContainer.offsetParent.offsetLeft + progressContainer.offsetLeft + progressContainer.clientWidth;
|
|
231
|
+
this.progressBarWidth = this.$refs.progressBar.clientWidth / 2;
|
|
232
|
+
document.addEventListener("mousemove", this.moveX);
|
|
318
233
|
document.addEventListener("mouseup", () => {
|
|
319
|
-
document.removeEventListener("mousemove", moveX);
|
|
234
|
+
document.removeEventListener("mousemove", this.moveX);
|
|
320
235
|
});
|
|
321
236
|
}
|
|
322
237
|
},
|
|
323
|
-
|
|
324
|
-
|
|
238
|
+
volumeChange(val) {
|
|
239
|
+
this.$emit("volumeChange", val);
|
|
325
240
|
},
|
|
326
241
|
/** 设置倍速播放 */
|
|
327
|
-
changeSpeed(
|
|
242
|
+
changeSpeed(speed) {
|
|
328
243
|
if (!this.disabled) {
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
audioPlayer.playbackRate = command;
|
|
244
|
+
if (this.audio) {
|
|
245
|
+
this.audio.playbackRate = speed;
|
|
332
246
|
}
|
|
333
|
-
this.speed =
|
|
247
|
+
this.speed = speed;
|
|
248
|
+
this.$emit("speedChange", speed);
|
|
334
249
|
}
|
|
335
250
|
},
|
|
336
|
-
downRecord() {
|
|
251
|
+
downRecord(e) {
|
|
337
252
|
if (!this.disabled) {
|
|
338
|
-
this.$emit("
|
|
253
|
+
this.$emit("download", e);
|
|
339
254
|
}
|
|
340
255
|
},
|
|
341
256
|
calcMoveX() {
|
|
342
257
|
if (!this.audio.paused) {
|
|
343
|
-
let MoveX = this.$refs.
|
|
344
|
-
this.$refs.
|
|
345
|
-
this.$refs.
|
|
258
|
+
let MoveX = this.$refs.progressContainer.clientWidth * (this.audio.currentTime / this.audio.duration);
|
|
259
|
+
this.$refs.progressCurrent.style.width = MoveX + "px";
|
|
260
|
+
this.$refs.progressBar.style.left = MoveX - this.$refs.progressBar.clientWidth / 2 + "px";
|
|
346
261
|
}
|
|
347
262
|
},
|
|
348
|
-
jumpToTime() {
|
|
263
|
+
jumpToTime(time) {
|
|
349
264
|
if (!this.disabled) {
|
|
350
265
|
this.audio.pause();
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
nfMessage.Message.warning("音频还未加载完成");
|
|
266
|
+
if (this.audio.duration === 0) {
|
|
267
|
+
nfMessage.Message.warning(this.unloadTip);
|
|
354
268
|
return false;
|
|
355
269
|
}
|
|
356
|
-
if (
|
|
357
|
-
this.audio.currentTime = this.duration;
|
|
358
|
-
this.
|
|
270
|
+
if (time >= this.audio.duration) {
|
|
271
|
+
this.audio.currentTime = this.audio.duration;
|
|
272
|
+
this.currentTime = timeFormat(this.audio.currentTime);
|
|
359
273
|
this.calcMoveX();
|
|
360
274
|
this.audio.play();
|
|
361
|
-
|
|
275
|
+
if (time > this.audio.duration) {
|
|
276
|
+
console.error(this.crossTimeTip);
|
|
277
|
+
}
|
|
362
278
|
return false;
|
|
363
|
-
} else if (
|
|
364
|
-
this.audio.currentTime =
|
|
365
|
-
this.
|
|
279
|
+
} else if (time >= 0 && time < this.audio.duration) {
|
|
280
|
+
this.audio.currentTime = time;
|
|
281
|
+
this.currentTime = timeFormat(this.audio.currentTime);
|
|
366
282
|
this.calcMoveX();
|
|
367
283
|
this.audio.play();
|
|
368
284
|
} else {
|
|
369
285
|
this.audio.currentTime = 0;
|
|
370
|
-
this.
|
|
286
|
+
this.currentTime = timeFormat(this.audio.currentTime);
|
|
371
287
|
this.calcMoveX();
|
|
372
288
|
this.audio.play();
|
|
373
289
|
}
|
|
@@ -375,18 +291,38 @@ const _sfc_main = {
|
|
|
375
291
|
}
|
|
376
292
|
},
|
|
377
293
|
watch: {
|
|
294
|
+
initSpeedValue: {
|
|
295
|
+
handle() {
|
|
296
|
+
this.speed = this.initSpeedValue;
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
initVolumnValue: {
|
|
300
|
+
handle() {
|
|
301
|
+
this.volume = this.initVolumnValue;
|
|
302
|
+
this.volumeValue = this.initVolumnValue * 100;
|
|
303
|
+
}
|
|
304
|
+
},
|
|
305
|
+
volumeVisible(val) {
|
|
306
|
+
if (val) {
|
|
307
|
+
window.addEventListener("mousedown", this.docClick);
|
|
308
|
+
} else {
|
|
309
|
+
window.removeEventListener("mousedown", this.docClick);
|
|
310
|
+
}
|
|
311
|
+
},
|
|
378
312
|
volumeValue(val) {
|
|
379
313
|
this.volume = val / 100;
|
|
380
314
|
this.audio.volume = val / 100;
|
|
381
315
|
}
|
|
382
316
|
}
|
|
383
317
|
};
|
|
384
|
-
var _sfc_render = function
|
|
318
|
+
var _sfc_render = function render() {
|
|
385
319
|
var _vm = this, _c = _vm._self._c;
|
|
386
320
|
return _c("div", {
|
|
387
|
-
staticClass: "nf-audio
|
|
321
|
+
staticClass: "nf-audio",
|
|
388
322
|
class: {
|
|
389
|
-
disabled: _vm.disabled
|
|
323
|
+
disabled: _vm.disabled,
|
|
324
|
+
[_vm.size]: true,
|
|
325
|
+
background: _vm.background
|
|
390
326
|
}
|
|
391
327
|
}, [_c("audio", {
|
|
392
328
|
directives: [{
|
|
@@ -399,120 +335,252 @@ var _sfc_render = function render3() {
|
|
|
399
335
|
attrs: {
|
|
400
336
|
"controls": "",
|
|
401
337
|
"crossOrigin": "anonymous",
|
|
402
|
-
"src": _vm.
|
|
338
|
+
"src": _vm.src
|
|
403
339
|
},
|
|
404
340
|
on: {
|
|
405
341
|
"canplay": _vm.getDuration,
|
|
406
342
|
"timeupdate": _vm.updateTime,
|
|
407
343
|
"ended": _vm.handleAudioEnded
|
|
408
344
|
}
|
|
409
|
-
}), _vm.
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
}, [_c("div", {
|
|
419
|
-
staticClass: "play",
|
|
420
|
-
on: {
|
|
421
|
-
"click": _vm.handlePauseOrPlay
|
|
422
|
-
}
|
|
423
|
-
}, [_c("i", {
|
|
424
|
-
directives: [{
|
|
425
|
-
name: "show",
|
|
426
|
-
rawName: "v-show",
|
|
427
|
-
value: !_vm.paused,
|
|
428
|
-
expression: "!paused"
|
|
429
|
-
}],
|
|
430
|
-
staticClass: "iconfont icon-zanting2 pause-icon"
|
|
431
|
-
}), _c("i", {
|
|
432
|
-
directives: [{
|
|
433
|
-
name: "show",
|
|
434
|
-
rawName: "v-show",
|
|
435
|
-
value: _vm.paused,
|
|
436
|
-
expression: "paused"
|
|
437
|
-
}],
|
|
438
|
-
staticClass: "iconfont icon-bofang1 play-icon"
|
|
439
|
-
})]), _c("div", {
|
|
440
|
-
staticClass: "time"
|
|
441
|
-
}, [_c("span", {
|
|
442
|
-
staticClass: "startTime"
|
|
443
|
-
}, [_vm._v(_vm._s(_vm.currentDuration))]), _vm._v("/ "), _c("span", {
|
|
444
|
-
staticClass: "endTime"
|
|
445
|
-
}, [_vm._v(_vm._s(_vm.duration))])]), _c("div", {
|
|
446
|
-
ref: "progress",
|
|
447
|
-
staticClass: "progress",
|
|
448
|
-
on: {
|
|
449
|
-
"click": _vm.clickProgress,
|
|
450
|
-
"mouseup": _vm.handleMouseup
|
|
451
|
-
}
|
|
452
|
-
}, [_c("div", {
|
|
453
|
-
ref: "currentProgress",
|
|
454
|
-
staticClass: "currentProgress"
|
|
455
|
-
}, [_c("span", {
|
|
456
|
-
ref: "circle",
|
|
457
|
-
staticClass: "circle",
|
|
458
|
-
on: {
|
|
459
|
-
"mousedown": _vm.handleMousedown
|
|
460
|
-
}
|
|
461
|
-
})])]), _c("div", {
|
|
462
|
-
staticClass: "nf-volume-panel"
|
|
463
|
-
}, [_c("volumeTool", {
|
|
464
|
-
attrs: {
|
|
465
|
-
"visible": _vm.volumeVisible,
|
|
466
|
-
"disabled": _vm.disabled
|
|
467
|
-
},
|
|
468
|
-
on: {
|
|
469
|
-
"update:visible": function($event) {
|
|
470
|
-
_vm.volumeVisible = $event;
|
|
345
|
+
}), _vm.jumpTime ? _vm._t("jump", function() {
|
|
346
|
+
return [_c("div", {
|
|
347
|
+
staticClass: "nf-audio-fast"
|
|
348
|
+
}, [_c("i", {
|
|
349
|
+
staticClass: "iconfont icon-zanting1 nf-audio-fast-icon",
|
|
350
|
+
on: {
|
|
351
|
+
"click": function($event) {
|
|
352
|
+
return _vm.jumpToTime(_vm.jumpTime);
|
|
353
|
+
}
|
|
471
354
|
}
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
355
|
+
})])];
|
|
356
|
+
}) : _vm._e(), _c("div", {
|
|
357
|
+
staticClass: "nf-audio-body"
|
|
358
|
+
}, [_vm._t("play", function() {
|
|
359
|
+
return [_c("div", {
|
|
360
|
+
staticClass: "nf-audio-play",
|
|
361
|
+
on: {
|
|
362
|
+
"click": _vm.handlePauseOrPlay
|
|
363
|
+
}
|
|
364
|
+
}, [_c("i", {
|
|
365
|
+
directives: [{
|
|
366
|
+
name: "show",
|
|
367
|
+
rawName: "v-show",
|
|
368
|
+
value: !_vm.paused,
|
|
369
|
+
expression: "!paused"
|
|
370
|
+
}],
|
|
371
|
+
staticClass: "iconfont icon-zanting2 nf-audio-pause-icon"
|
|
372
|
+
}), _c("i", {
|
|
373
|
+
directives: [{
|
|
374
|
+
name: "show",
|
|
375
|
+
rawName: "v-show",
|
|
376
|
+
value: _vm.paused,
|
|
377
|
+
expression: "paused"
|
|
378
|
+
}],
|
|
379
|
+
staticClass: "iconfont icon-bofang1 nf-audio-play-icon"
|
|
380
|
+
})])];
|
|
381
|
+
}, {
|
|
382
|
+
"paused": _vm.paused
|
|
383
|
+
}), _vm._t("time", function() {
|
|
384
|
+
return [_c("div", {
|
|
385
|
+
staticClass: "nf-audio-time"
|
|
386
|
+
}, [_c("span", {
|
|
387
|
+
staticClass: "startTime"
|
|
388
|
+
}, [_vm._v(_vm._s(_vm.currentTime))]), _vm._v("/ "), _c("span", {
|
|
389
|
+
staticClass: "endTime"
|
|
390
|
+
}, [_vm._v(_vm._s(_vm.totalTime))])])];
|
|
391
|
+
}, {
|
|
392
|
+
"currentTime": _vm.currentTime,
|
|
393
|
+
"totalTime": _vm.totalTime
|
|
394
|
+
}), _vm.backSecond ? _vm._t("fastBack", function() {
|
|
395
|
+
return [_c("el-tooltip", {
|
|
396
|
+
staticClass: "nf-audio-pre",
|
|
397
|
+
attrs: {
|
|
398
|
+
"placement": "top",
|
|
399
|
+
"disabled": _vm.disabled
|
|
400
|
+
}
|
|
401
|
+
}, [_c("span", {
|
|
402
|
+
staticStyle: {
|
|
403
|
+
"color": "#C7C7C9",
|
|
404
|
+
"font-size": "13px"
|
|
481
405
|
},
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
}, [_c("el-slider", {
|
|
485
|
-
class: _vm.volumeValue === 0 ? "volume-mute-slider" : "volume-phonic",
|
|
486
|
-
attrs: {
|
|
487
|
-
"vertical": "",
|
|
488
|
-
"min": 0,
|
|
489
|
-
"max": 100,
|
|
490
|
-
"show-tooltip": _vm.volumeVisible,
|
|
491
|
-
"height": "60px"
|
|
492
|
-
},
|
|
493
|
-
on: {
|
|
494
|
-
"change": _vm.rangeVolume
|
|
495
|
-
},
|
|
496
|
-
model: {
|
|
497
|
-
value: _vm.volumeValue,
|
|
498
|
-
callback: function($$v) {
|
|
499
|
-
_vm.volumeValue = $$v;
|
|
406
|
+
attrs: {
|
|
407
|
+
"slot": "content"
|
|
500
408
|
},
|
|
501
|
-
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
attrs: {
|
|
507
|
-
"disabled": _vm.disabled
|
|
508
|
-
},
|
|
509
|
-
on: {
|
|
510
|
-
"down": function($event) {
|
|
511
|
-
return _vm.downRecord();
|
|
409
|
+
slot: "content"
|
|
410
|
+
}, [_vm._v(" -" + _vm._s(_vm.backSecond) + "s ")]), _c("nf-button", {
|
|
411
|
+
staticStyle: {
|
|
412
|
+
"padding": "3px",
|
|
413
|
+
"border-radius": "50%"
|
|
512
414
|
},
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
415
|
+
attrs: {
|
|
416
|
+
"type": "text",
|
|
417
|
+
"disabled": _vm.disabled
|
|
418
|
+
},
|
|
419
|
+
on: {
|
|
420
|
+
"click": _vm.handleBack
|
|
421
|
+
}
|
|
422
|
+
}, [_c("i", {
|
|
423
|
+
staticClass: "el-icon-d-arrow-left"
|
|
424
|
+
})])], 1)];
|
|
425
|
+
}) : _vm._e(), _vm._t("progress", function() {
|
|
426
|
+
return [_c("div", {
|
|
427
|
+
ref: "progressContainer",
|
|
428
|
+
staticClass: "nf-audio-progress-container",
|
|
429
|
+
on: {
|
|
430
|
+
"click": _vm.clickProgress,
|
|
431
|
+
"mouseup": _vm.handleMouseup
|
|
432
|
+
}
|
|
433
|
+
}, [_c("div", {
|
|
434
|
+
ref: "progressCurrent",
|
|
435
|
+
staticClass: "nf-audio-progress-current"
|
|
436
|
+
}, [_c("span", {
|
|
437
|
+
ref: "progressBar",
|
|
438
|
+
staticClass: "nf-audio-progress-bar",
|
|
439
|
+
on: {
|
|
440
|
+
"mousedown": _vm.handleMousedown
|
|
441
|
+
}
|
|
442
|
+
})])])];
|
|
443
|
+
}), _vm.forwardSecond ? _vm._t("fastForward", function() {
|
|
444
|
+
return [_c("el-tooltip", {
|
|
445
|
+
staticClass: "nf-audio-next",
|
|
446
|
+
attrs: {
|
|
447
|
+
"disabled": _vm.disabled
|
|
448
|
+
}
|
|
449
|
+
}, [_c("span", {
|
|
450
|
+
staticStyle: {
|
|
451
|
+
"color": "#C7C7C9",
|
|
452
|
+
"font-size": "13px"
|
|
453
|
+
},
|
|
454
|
+
attrs: {
|
|
455
|
+
"slot": "content"
|
|
456
|
+
},
|
|
457
|
+
slot: "content"
|
|
458
|
+
}, [_vm._v(" +" + _vm._s(_vm.forwardSecond) + "s ")]), _c("nf-button", {
|
|
459
|
+
staticStyle: {
|
|
460
|
+
"padding": "3px",
|
|
461
|
+
"border-radius": "50%"
|
|
462
|
+
},
|
|
463
|
+
attrs: {
|
|
464
|
+
"type": "text",
|
|
465
|
+
"disabled": _vm.disabled
|
|
466
|
+
},
|
|
467
|
+
on: {
|
|
468
|
+
"click": _vm.handleForward
|
|
469
|
+
}
|
|
470
|
+
}, [_c("i", {
|
|
471
|
+
staticClass: "el-icon-d-arrow-right"
|
|
472
|
+
})])], 1)];
|
|
473
|
+
}) : _vm._e(), _vm._t("volume", function() {
|
|
474
|
+
return [_c("div", {
|
|
475
|
+
staticClass: "nf-audio-volume-tool",
|
|
476
|
+
class: _vm.volumeVisible ? "nf-audio-tool-show" : ""
|
|
477
|
+
}, [_c("div", {
|
|
478
|
+
ref: "reference",
|
|
479
|
+
on: {
|
|
480
|
+
"click": _vm.showPopper
|
|
481
|
+
}
|
|
482
|
+
}, [_vm.volume == 0 ? _vm._t("volume-mute", function() {
|
|
483
|
+
return [_c("i", {
|
|
484
|
+
staticClass: "iconfont icon-yinliang_guanbi nf-audio-volume-mute"
|
|
485
|
+
})];
|
|
486
|
+
}) : _vm._t("volume-unmute", function() {
|
|
487
|
+
return [_c("i", {
|
|
488
|
+
staticClass: "iconfont icon-yinliang_kaiqi nf-audio-volume-unmute"
|
|
489
|
+
})];
|
|
490
|
+
})], 2), _c("transition", {
|
|
491
|
+
attrs: {
|
|
492
|
+
"name": "nf-audio-slide-fade"
|
|
493
|
+
}
|
|
494
|
+
}, [_c("div", {
|
|
495
|
+
directives: [{
|
|
496
|
+
name: "show",
|
|
497
|
+
rawName: "v-show",
|
|
498
|
+
value: _vm.volumeVisible,
|
|
499
|
+
expression: "volumeVisible"
|
|
500
|
+
}],
|
|
501
|
+
ref: "popperRef",
|
|
502
|
+
staticClass: "nf-audio-volume-popper"
|
|
503
|
+
}, [_c("el-slider", {
|
|
504
|
+
attrs: {
|
|
505
|
+
"vertical": "",
|
|
506
|
+
"min": 0,
|
|
507
|
+
"max": 100,
|
|
508
|
+
"show-tooltip": _vm.volumeVisible,
|
|
509
|
+
"height": "60px"
|
|
510
|
+
},
|
|
511
|
+
on: {
|
|
512
|
+
"change": _vm.volumeChange
|
|
513
|
+
},
|
|
514
|
+
model: {
|
|
515
|
+
value: _vm.volumeValue,
|
|
516
|
+
callback: function($$v) {
|
|
517
|
+
_vm.volumeValue = $$v;
|
|
518
|
+
},
|
|
519
|
+
expression: "volumeValue"
|
|
520
|
+
}
|
|
521
|
+
})], 1)])], 1)];
|
|
522
|
+
}, {
|
|
523
|
+
"volume": _vm.volume,
|
|
524
|
+
"volumeVisible": _vm.volumeVisible
|
|
525
|
+
}), _vm.showMoreBtn ? _vm._t("more", function() {
|
|
526
|
+
return [_c("div", {
|
|
527
|
+
staticClass: "nf-audio-more-btn-box"
|
|
528
|
+
}, [_c("el-popover", {
|
|
529
|
+
attrs: {
|
|
530
|
+
"placement": "right",
|
|
531
|
+
"popper-class": "nf-audio-popover",
|
|
532
|
+
"append-to-body": false,
|
|
533
|
+
"disabled": _vm.disabled
|
|
534
|
+
}
|
|
535
|
+
}, [_vm._t("more-btn-list", function() {
|
|
536
|
+
return [_c("div", {
|
|
537
|
+
staticClass: "nf-audio-btn-list"
|
|
538
|
+
}, [_c("el-popover", {
|
|
539
|
+
attrs: {
|
|
540
|
+
"placement": "right",
|
|
541
|
+
"popper-class": "nf-audio-popover",
|
|
542
|
+
"append-to-body": false,
|
|
543
|
+
"disabled": _vm.disabled
|
|
544
|
+
}
|
|
545
|
+
}, [_vm._t("speed-btn-list", function() {
|
|
546
|
+
return [_c("div", {
|
|
547
|
+
staticClass: "nf-audio-btn-list"
|
|
548
|
+
}, _vm._l(_vm.multipleArray, function(item, index) {
|
|
549
|
+
return _c("div", {
|
|
550
|
+
key: index,
|
|
551
|
+
staticClass: "nf-audio-btn-item",
|
|
552
|
+
class: _vm.speed === item ? "active" : "",
|
|
553
|
+
on: {
|
|
554
|
+
"click": function($event) {
|
|
555
|
+
return _vm.changeSpeed(item);
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
}, [_vm._v(" " + _vm._s(_vm.speedPreDesc) + _vm._s(item) + " ")]);
|
|
559
|
+
}), 0)];
|
|
560
|
+
}), _c("div", {
|
|
561
|
+
staticClass: "nf-audio-btn-item",
|
|
562
|
+
attrs: {
|
|
563
|
+
"slot": "reference"
|
|
564
|
+
},
|
|
565
|
+
slot: "reference"
|
|
566
|
+
}, [_vm._v(_vm._s(_vm.speedDesc))])], 2), _c("div", {
|
|
567
|
+
staticClass: "nf-audio-btn-item",
|
|
568
|
+
on: {
|
|
569
|
+
"click": _vm.downRecord
|
|
570
|
+
}
|
|
571
|
+
}, [_vm._v(_vm._s(_vm.downloadDesc))])], 1)];
|
|
572
|
+
}), _c("div", {
|
|
573
|
+
staticClass: "nf-audio-more-icon-container",
|
|
574
|
+
attrs: {
|
|
575
|
+
"slot": "reference"
|
|
576
|
+
},
|
|
577
|
+
slot: "reference"
|
|
578
|
+
}, [_c("i", {
|
|
579
|
+
staticClass: "iconfont icon-gengduo1 nf-audio-more-icon"
|
|
580
|
+
})])], 2)], 1)];
|
|
581
|
+
}, {
|
|
582
|
+
"showMoreBtn": _vm.showMoreBtn
|
|
583
|
+
}) : _vm._e()], 2)], 2);
|
|
516
584
|
};
|
|
517
585
|
var _sfc_staticRenderFns = [];
|
|
518
586
|
var __component__ = /* @__PURE__ */ vue2RuntimeHelpers.normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, null, null, null);
|