|
@@ -40,14 +40,7 @@ let resultAudioContext = null
|
|
|
let wsEngine = aiengine.createWsEngine({});
|
|
|
/*微信录音*/
|
|
|
let recorderManager = wx.getRecorderManager();
|
|
|
-let options = {
|
|
|
- duration: 600000,
|
|
|
- sampleRate: 44100, //采样率
|
|
|
- numberOfChannels: 1, //录音通道数
|
|
|
- encodeBitRate: 192000, //编码码率
|
|
|
- format: 'mp3', //音频格式,有效值aac/mp3
|
|
|
- frameSize: 50 //指定帧大小,单位 KB
|
|
|
-};
|
|
|
+
|
|
|
Page({
|
|
|
data: {
|
|
|
videoInfo: {},
|
|
@@ -97,12 +90,12 @@ Page({
|
|
|
})
|
|
|
this.getreadInfo(videoId, options.reset).then(res => {
|
|
|
wx.nextTick(() => {
|
|
|
- /* if (options.voluntarily && this.data.isVip) {
|
|
|
- this.setCountDown()
|
|
|
- }
|
|
|
- if (options.autoPlay) {
|
|
|
- this.videoPlay()
|
|
|
- } */
|
|
|
+ if (options.voluntarily && this.data.isVip) {
|
|
|
+ this.setCountDown()
|
|
|
+ }
|
|
|
+ if (options.autoPlay) {
|
|
|
+ this.videoPlay()
|
|
|
+ }
|
|
|
})
|
|
|
})
|
|
|
// 手工绑定
|
|
@@ -302,12 +295,11 @@ Page({
|
|
|
}
|
|
|
let lessonText = JSON.parse(this.data.videoInfo.userReadExtend.lessonText).map((item) => {
|
|
|
return item.text
|
|
|
- }).join('')
|
|
|
+ }).join('\n')
|
|
|
// userReadExtend 中 businessType 0:中文/ 1: 英文 / 2: 歌曲
|
|
|
let businessType = this.data.videoInfo.userReadExtend.businessType
|
|
|
- console.log(businessType, 'businessType');
|
|
|
// https://www.chivox.com/opendoc/#/ChineseDoc/coreCn/Chinese/cn.sent.raw?id=%e5%8f%82%e6%95%b0%e8%af%b4%e6%98%8e <----参数说明
|
|
|
- console.log('启动了');
|
|
|
+ console.log('启动了', businessType == 0 ? "cn.pred.raw" : "en.pred.score");
|
|
|
wsEngine.start({
|
|
|
request: {
|
|
|
coreType: businessType == 0 ? "cn.pred.raw" : "en.pred.score",
|
|
@@ -328,8 +320,15 @@ Page({
|
|
|
},
|
|
|
success: (res) => {
|
|
|
/*引擎启动成功,可以启动录音机开始录音,并将音频片传给引擎*/
|
|
|
- //开始录音,在开始录音回调中feed音频片
|
|
|
- recorderManager.start(this.options);
|
|
|
+ let recorderOptions = {
|
|
|
+ duration: 600000,
|
|
|
+ sampleRate: 44100, //采样率
|
|
|
+ numberOfChannels: 1, //录音通道数
|
|
|
+ encodeBitRate: 192000, //编码码率
|
|
|
+ format: 'mp3', //音频格式,有效值aac/mp3
|
|
|
+ frameSize: 50 //指定帧大小,单位 KB
|
|
|
+ };
|
|
|
+ recorderManager.start(recorderOptions);
|
|
|
},
|
|
|
fail: (res) => {
|
|
|
console.log("fail============= ", res);
|
|
@@ -373,7 +372,15 @@ Page({
|
|
|
},
|
|
|
songRecording() {
|
|
|
//开始录音,在开始录音回调中feed音频片
|
|
|
- recorderManager.start(this.options);
|
|
|
+ let recorderOptions = {
|
|
|
+ duration: 600000,
|
|
|
+ sampleRate: 44100, //采样率
|
|
|
+ numberOfChannels: 1, //录音通道数
|
|
|
+ encodeBitRate: 192000, //编码码率
|
|
|
+ format: 'mp3', //音频格式,有效值aac/mp3
|
|
|
+ frameSize: 50 //指定帧大小,单位 KB
|
|
|
+ };
|
|
|
+ recorderManager.start(recorderOptions);
|
|
|
recorderManager.onError(res => {
|
|
|
console.log(res, 'songError');
|
|
|
})
|
|
@@ -444,7 +451,6 @@ Page({
|
|
|
// 获取测评结果
|
|
|
async getRecordScore(res) {
|
|
|
let result = res.result;
|
|
|
- console.log(result, 'result');
|
|
|
let businessType = this.data.videoInfo.userReadExtend.businessType
|
|
|
let integrity = Math.floor(result.integrity); //完成度
|
|
|
let accuracy = Math.floor(result.accuracy); // 准确度 发音分
|
|
@@ -550,7 +556,6 @@ Page({
|
|
|
}
|
|
|
}
|
|
|
let result = await uploadPk(data)
|
|
|
- console.log(result, 'rrrr');
|
|
|
await userEvent({
|
|
|
action: 'WXPKUPLOAD',
|
|
|
})
|
|
@@ -565,7 +570,6 @@ Page({
|
|
|
}
|
|
|
});
|
|
|
uploadTask.onProgressUpdate((res) => {
|
|
|
- console.log('作品上传进度', res.progress);
|
|
|
this.setData({
|
|
|
percent: res.progress
|
|
|
})
|
|
@@ -745,7 +749,6 @@ Page({
|
|
|
async toBuy({
|
|
|
detail
|
|
|
}) {
|
|
|
- console.log(detail);
|
|
|
wx.showLoading({
|
|
|
title: '提交中',
|
|
|
mask: true
|
|
@@ -862,7 +865,6 @@ Page({
|
|
|
}
|
|
|
}
|
|
|
setTimeout(() => {
|
|
|
- console.log(wx.getStorageSync('shareVideoId'), 'reading-wx.getStorageSync');
|
|
|
wx.canvasToTempFilePath({
|
|
|
canvas: canvas,
|
|
|
success(res) {
|