修复了重新录音出错的问题

master
limenglian 5 years ago
parent 951b2499d1
commit 7d38838bec

@ -15,16 +15,14 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.videoContext = wx.createVideoContext('myVideo');
// var time = this.videoContext.duration;
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
// this.videoContext = wx.createVideoContext('myVideo');
this.videoContext = wx.createVideoContext('myVideo');
},
/**
@ -68,14 +66,7 @@ Page({
onShareAppMessage: function () {
},
endDub() {
this.videoContext.stop();
wx.stopRecord();
wx.navigateTo({
url: '../previewWork/previewWork',
})
},
//预览素材
playingFodder: function () {
this.setData({
@ -87,12 +78,6 @@ Page({
// 开始录音,
startDub: function () {
/*
this.videoContext.src = 'cloud://dunning-bar-enr-3e46z.6475-dunning-bar-enr-3e46z-1300499016/huaizhugege-erkang.mp4' ;
var time = this.videoContext.duration;
console.log(time);
*/
this.videoContext.seek(0);
this.videoContext.play();
//speaking.call(this);
@ -126,21 +111,37 @@ Page({
content: '录音出错'
})
},
});
},
funended: function () {
console.log('eeee');
console.log('录音结束');
wx.stopRecord();// 结束录音
wx.navigateTo({//视频播放完成自动跳转到预览页面
url: '../previewWork/previewWork',
})
}
},
//重新录音
reDub: function () {
wx.stopRecord();
this.setData({
isSpeaking: false
});
/*
setTimeout(function () {
wx.stopRecord();// 结束录音
wx.navigateTo({//视频播放完成自动跳转到预览页面
wx.showModal({
title: '提示',
content: '重新录音'
});
this.startDub();
},
//结束录音
endDub: function () {
console.log('录音结束');
this.videoContext.stop();
wx.stopRecord();
wx.navigateTo({
url: '../previewWork/previewWork',
})
},time);
*/
},
})

@ -1,10 +1,12 @@
<!--miniprogram/pages/Dubbing/Dubbing.wxml-->
<view>
<video id="myVideo" src="cloud://dunning-bar-enr-3e46z.6475-dunning-bar-enr-3e46z-1300499016/huaizhugege-erkang.mp4"muted ="{{muted}}" binended = "funended" controls ="{{false}}" show-play-btn ="{{false}}"show-fullscreen-btn = "{{false}}" show-center-play-btn="{{false}}" style="width: 400px; height: 200px;"></video>
<video id="myVideo" src="cloud://dunning-bar-enr-3e46z.6475-dunning-bar-enr-3e46z-1300499016/video/video_1.mp4"
muted ="{{muted}}" bindended="funended" custom-cache="{{false}}" controls ="{{false}}" show-play-btn ="{{false}}"show-fullscreen-btn = "{{false}}" show-center-play-btn="{{false}}" style="width: 300px; height: 200px;"></video>
</view>
<view>
<button bindtap="playingFodder">预览素材</button>
<button bindtap="startDub">开始录音</button>
<button bindtap="reDub">重新录制</button>
<button bindtap="endDub">完成录音</button>
</view>

Loading…
Cancel
Save