音频
This commit is contained in:
@@ -17,8 +17,9 @@
|
||||
<view class="audo-video">
|
||||
<view class="slider-box">
|
||||
<text class="mm">{{ timer }}</text>
|
||||
|
||||
<slider
|
||||
style="width: calc(100% - 280rpx)"
|
||||
style="width: 440rpx"
|
||||
@change="sliderChange"
|
||||
@changing="sliderChanging"
|
||||
class="audio-slider"
|
||||
@@ -222,7 +223,7 @@ export default {
|
||||
recorPath: "", //音频播放地址
|
||||
lock: false, // 锁
|
||||
currentTime: 0, //当前进度
|
||||
duration: 100, // 总进度
|
||||
duration: 0, // 总进度
|
||||
videoContext: null,
|
||||
loading: true, //锁 加载
|
||||
curTime: null, //锁 加载
|
||||
@@ -238,30 +239,29 @@ export default {
|
||||
onHide() {
|
||||
//监听页面离开 - 销毁音频
|
||||
this.stop_();
|
||||
this.$emit("curTime", this.curTime);
|
||||
this.$emit("curTime", this.curTime);
|
||||
},
|
||||
onUnload() {
|
||||
|
||||
//监听页面卸载 - 销毁音频
|
||||
this.stop_();this.$emit("curTime", this.curTime);
|
||||
this.stop_();
|
||||
this.$emit("curTime", this.curTime);
|
||||
},
|
||||
destroyed() {
|
||||
// this.innerAudioContext.stop();
|
||||
},
|
||||
computed: {
|
||||
timer() {
|
||||
this.curTime = this.currentTime;
|
||||
this.curTime = this.currentTime;
|
||||
return calcTimer(this.currentTime);
|
||||
},
|
||||
overTimer() {
|
||||
this.curTime = this.duration;
|
||||
return calcTimer(this.duration);
|
||||
},
|
||||
},
|
||||
|
||||
methods: {
|
||||
init() {
|
||||
this.currentTime=this.firstTime;
|
||||
this.currentTime = this.firstTime;
|
||||
this.videoContext = uni.createVideoContext("myVideo", this);
|
||||
//默认播放第一个
|
||||
if (this.list.length != 0) {
|
||||
@@ -277,9 +277,6 @@ export default {
|
||||
this.bsid = this.BsNav[0].id;
|
||||
this.playbackRate(); //倍数
|
||||
}
|
||||
this.seek(this.firstTime);
|
||||
this.curTime = this.currentTime
|
||||
|
||||
},
|
||||
//没有音频数据
|
||||
noUrl() {
|
||||
@@ -384,7 +381,9 @@ export default {
|
||||
duration = event.detail.duration;
|
||||
}
|
||||
this.currentTime = currentTime;
|
||||
console.log("this.currentTime at line 當前386:", this.currentTime);
|
||||
this.duration = duration;
|
||||
console.log("this.duration at line 總時長388:", this.duration);
|
||||
},
|
||||
|
||||
// 拖动进度条
|
||||
@@ -416,7 +415,11 @@ export default {
|
||||
|
||||
// 视频加载完成
|
||||
loadedmetadata(data) {
|
||||
console.log("data at line zh:", data);
|
||||
this.duration = data.detail.duration;
|
||||
|
||||
// this.seek(this.firstTime);
|
||||
// this.curTime = this.currentTime
|
||||
},
|
||||
|
||||
//音频结束触发
|
||||
@@ -512,8 +515,7 @@ export default {
|
||||
};
|
||||
//时间换算
|
||||
function calcTimer(timer) {
|
||||
console.log('timer at line 514:', timer)
|
||||
|
||||
console.log("timer at line 514:", timer);
|
||||
|
||||
if (timer === 0 || typeof timer !== "number") {
|
||||
return "00:00";
|
||||
|
||||
Reference in New Issue
Block a user