From 7d38838bec5f0b1100cf1bb929d1992159a2bac6 Mon Sep 17 00:00:00 2001
From: limenglian <1485838991@qq.com>
Date: Fri, 3 Jan 2020 23:21:45 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E9=87=8D=E6=96=B0?=
=?UTF-8?q?=E5=BD=95=E9=9F=B3=E5=87=BA=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Dubbing/Dubbing.js | 109 ++++++++++++++++++++++---------------------
Dubbing/Dubbing.wxml | 4 +-
2 files changed, 58 insertions(+), 55 deletions(-)
diff --git a/Dubbing/Dubbing.js b/Dubbing/Dubbing.js
index f5e1922..0d27014 100644
--- a/Dubbing/Dubbing.js
+++ b/Dubbing/Dubbing.js
@@ -4,27 +4,25 @@ Page({
/**
* 页面的初始数据
*/
-
+
data: {
isSpeaking: false,//是否正在说话
voices: [],//音频数组:
- muted:false
+ muted: false
},
/**
* 生命周期函数--监听页面加载
*/
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,79 +66,82 @@ Page({
onShareAppMessage: function () {
},
- endDub() {
- this.videoContext.stop();
- wx.stopRecord();
- wx.navigateTo({
- url: '../previewWork/previewWork',
- })
-
- },
+
//预览素材
- playingFodder:function(){
+ playingFodder: function () {
this.setData({
- muted:false
+ muted: false
})
this.videoContext.play();
},
-
- // 开始录音,
+
+ // 开始录音,
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.seek(0);
this.videoContext.play();
//speaking.call(this);
this.setData({
- isSpeaking:true,
+ isSpeaking: true,
muted: true,
})
wx.startRecord({
- success:function(res){
- var tempFilepath=res.tempFilePath;
+ success: function (res) {
+ var tempFilepath = res.tempFilePath;
wx.saveFile({
tempFilePath: tempFilepath,
- success:function(res){
- var savedFilepath=res.savedFilePath;
+ success: function (res) {
+ var savedFilepath = res.savedFilePath;
getApp().globalData.workPath = savedFilepath;
- // this.setData({
- // wfilePath: savedFilePath
- // });
+ // this.setData({
+ // wfilePath: savedFilePath
+ // });
console.log(getApp().globalData.workPath);
},
}),
- wx.showToast({
- title: '录音成功',
- icon:'success',
- duration:200
- })
+ wx.showToast({
+ title: '录音成功',
+ icon: 'success',
+ duration: 200
+ })
},
- fail:function(res){
+ fail: function (res) {
wx.showModal({
title: '提示',
content: '录音出错'
})
},
- funended: function () {
- console.log('eeee');
- wx.stopRecord();// 结束录音
- wx.navigateTo({//视频播放完成自动跳转到预览页面
- url: '../previewWork/previewWork',
- })
- }
});
- /*
- setTimeout(function () {
- wx.stopRecord();// 结束录音
- wx.navigateTo({//视频播放完成自动跳转到预览页面
- url: '../previewWork/previewWork',
- })
- },time);
- */
- },
+
+ },
+
+ funended: function () {
+ console.log('录音结束');
+ wx.stopRecord();// 结束录音
+ wx.navigateTo({//视频播放完成自动跳转到预览页面
+ url: '../previewWork/previewWork',
+ })
+ },
+
+ //重新录音
+ reDub: function () {
+ wx.stopRecord();
+ this.setData({
+ isSpeaking: false
+ });
+ wx.showModal({
+ title: '提示',
+ content: '重新录音'
+ });
+ this.startDub();
+ },
+ //结束录音
+ endDub: function () {
+ console.log('录音结束');
+ this.videoContext.stop();
+ wx.stopRecord();
+ wx.navigateTo({
+ url: '../previewWork/previewWork',
+ })
+ },
})
\ No newline at end of file
diff --git a/Dubbing/Dubbing.wxml b/Dubbing/Dubbing.wxml
index 7eeefde..0ba4a96 100644
--- a/Dubbing/Dubbing.wxml
+++ b/Dubbing/Dubbing.wxml
@@ -1,10 +1,12 @@
-
+
+