From 63993fcf275ce95c310a00e2793108a7609fe762 Mon Sep 17 00:00:00 2001
From: limenglian <1485838991@qq.com>
Date: Wed, 1 Jan 2020 23:17:30 +0800
Subject: [PATCH] first commit
---
Dubbing/Dubbing.js | 146 +++++++++++++++++++++++++++++++++++++++++++
Dubbing/Dubbing.json | 3 +
Dubbing/Dubbing.wxml | 10 +++
Dubbing/Dubbing.wxss | 1 +
4 files changed, 160 insertions(+)
create mode 100644 Dubbing/Dubbing.js
create mode 100644 Dubbing/Dubbing.json
create mode 100644 Dubbing/Dubbing.wxml
create mode 100644 Dubbing/Dubbing.wxss
diff --git a/Dubbing/Dubbing.js b/Dubbing/Dubbing.js
new file mode 100644
index 0000000..f5e1922
--- /dev/null
+++ b/Dubbing/Dubbing.js
@@ -0,0 +1,146 @@
+// miniprogram/pages/Dubbing/Dubbing.js
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+
+ data: {
+ isSpeaking: false,//是否正在说话
+ voices: [],//音频数组:
+ muted:false
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad: function (options) {
+ this.videoContext = wx.createVideoContext('myVideo');
+
+ // var time = this.videoContext.duration;
+ },
+
+ /**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+ onReady: function () {
+ // this.videoContext = wx.createVideoContext('myVideo');
+ },
+
+ /**
+ * 生命周期函数--监听页面显示
+ */
+ onShow: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面隐藏
+ */
+ onHide: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面卸载
+ */
+ onUnload: function () {
+
+ },
+
+ /**
+ * 页面相关事件处理函数--监听用户下拉动作
+ */
+ onPullDownRefresh: function () {
+
+ },
+
+ /**
+ * 页面上拉触底事件的处理函数
+ */
+ onReachBottom: function () {
+
+ },
+
+ /**
+ * 用户点击右上角分享
+ */
+ onShareAppMessage: function () {
+
+ },
+ endDub() {
+ this.videoContext.stop();
+ wx.stopRecord();
+ wx.navigateTo({
+ url: '../previewWork/previewWork',
+ })
+
+ },
+ //预览素材
+ playingFodder:function(){
+ this.setData({
+ 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.play();
+ //speaking.call(this);
+ this.setData({
+ isSpeaking:true,
+ muted: true,
+ })
+ wx.startRecord({
+ success:function(res){
+ var tempFilepath=res.tempFilePath;
+ wx.saveFile({
+ tempFilePath: tempFilepath,
+ success:function(res){
+ var savedFilepath=res.savedFilePath;
+ getApp().globalData.workPath = savedFilepath;
+ // this.setData({
+ // wfilePath: savedFilePath
+ // });
+ console.log(getApp().globalData.workPath);
+ },
+ }),
+ wx.showToast({
+ title: '录音成功',
+ icon:'success',
+ duration:200
+ })
+ },
+ 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);
+ */
+ },
+})
\ No newline at end of file
diff --git a/Dubbing/Dubbing.json b/Dubbing/Dubbing.json
new file mode 100644
index 0000000..8835af0
--- /dev/null
+++ b/Dubbing/Dubbing.json
@@ -0,0 +1,3 @@
+{
+ "usingComponents": {}
+}
\ No newline at end of file
diff --git a/Dubbing/Dubbing.wxml b/Dubbing/Dubbing.wxml
new file mode 100644
index 0000000..7eeefde
--- /dev/null
+++ b/Dubbing/Dubbing.wxml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/Dubbing/Dubbing.wxss b/Dubbing/Dubbing.wxss
new file mode 100644
index 0000000..7680d71
--- /dev/null
+++ b/Dubbing/Dubbing.wxss
@@ -0,0 +1 @@
+/* miniprogram/pages/Dubbing/Dubbing.wxss */
\ No newline at end of file